Cod sursa(job #711328)

Utilizator brainwashed20Alexandru Gherghe brainwashed20 Data 11 martie 2012 22:15:01
Problema A+B Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 2.05 kb
#include <stdio.h>

int main()
{
    int a,b;

	freopen("adunare.in","r",stdin);
	scanf("%d%d",&a,&b);
	freopen("adunare.out","w",stdout);
	printf("%d\n",a+b);

	return 0;
}

/* // 1001110111101010011
#include<cstdio>
#include<cstring>

using namespace std;

#define Nmax 100001
#define Mmax 10001

int N, M, dim, V[Mmax], D[Mmax], sol;
char sir[Nmax];

inline int max(int a, int b) {
	if(a>b)
		return a;
	return b;
}

inline long long put2(int x) {
	if(x==0)
		return 1;
	long long rez=1;
	while(x--) 
		rez*=2*1LL;
	return rez;
}

void dinamica() {
	int i, j;
	D[1]=0;
	for(i=1; i<=M; i++) {
		for(j=i-1; j>=1; j--)
			if(V[i]>V[j])
				D[i]=max(D[i],D[j]);
		D[i]++;
		sol=max(D[i],sol);
	}
}

long long getmaxnr(int max, int fpoz) {
	int i, j;
	long long nr=0;
	if(fpoz==dim-1) {
		for(i=fpoz, j=1; j<=max && i>=0; i--, j++)
			nr+=1LL*(sir[i]-'0')*put2(j-1);
	}
	else 
		if(fpoz==0)
			nr=1;
	else
		{
		for(i=fpoz+N-max, j=1; j<=N && i>=0; i--, j++)
			nr+=1LL*(sir[i]-'0')*put2(j-1);
	}
	
	return 1LL*nr;
}
int zecimal(int A, int B) {
	int nr=0, i, j;
	for(i=B, j=0; i>=A; i--, j++)
		nr+=(sir[i]-'0')*put2(j);
	return nr;
}

void formez_nr(int &poz, int prec, int &cur) {
	int i, numar;
	i=0;
	while(i<N && i+poz<dim) {
		numar=zecimal(poz,poz+i);
		if(numar>prec) {
			cur=zecimal(poz,poz+i);
			poz=poz+i+1;
			return;
		}
		i++;
	} 
	if(i==4)
		i--;
	cur=zecimal(poz,poz+i);
	poz=poz+i+1;
}
	

int main() {
	freopen("blis.in","r",stdin);
	freopen("blis.out","w",stdout);
	
	int i, cnt, poz, max, fpoz, prec, cur;
	
	scanf("%d\n",&N);
	i=0; cnt=0; poz=0; max=0;
	while(!feof(stdin)) {
		scanf("%c",&sir[i]);
		if(sir[i]=='1') {
			++cnt;
			poz=i;
			if(cnt>max && cnt<=N) {
				max=cnt;
				fpoz=i;
			}	
		}
		else
			cnt=0;
		++i;
	}
	dim=strlen(sir);
	printf("%lld\n",getmaxnr(max,fpoz));
	
	V[++M]=sir[0]-'0'; prec=V[M];
	for(i=1; i<dim;) {
		formez_nr(i, prec, cur);
		V[++M]=cur;
		prec=cur;
	}
	dinamica();
	printf("%d\n",sol);
	
	return 0;
}
*/