Pagini recente » Cod sursa (job #1757499) | Cod sursa (job #1239275) | Cod sursa (job #1295186) | Rating Nicolae Dumitrache (Nicky_Dumitrache) | Cod sursa (job #1699575)
#include <stdio.h>
using namespace std;
char x[211], y[211];
short lx,ly;
void sum() {
int xx,i, T = 0;
char ch;
ly = lx;
for(i = 1; i <= ly; i++) {
xx = (x[i]-'0')+(y[i]-'0')+T;
T = xx/10;
ch = x[i];
x[i] = (xx%10)+'0';
y[i] = ch;
}
if(T){
x[++lx] = T+'0';
}
}
int main() {
short N,i;
freopen("perioada01.in", "r", stdin);
freopen("perioada01.out", "w", stdout);
scanf("%d", &N);
N++;
for(i = 1;i <= 205;i++){
x[i] = y[i] = '0';
}
x[1] = '1';
lx = 1;
N--;
while(N-- % 1332028) {
sum();
}
for(i = lx; i >= 1; i--) {
printf("%d", x[i]-'0');
}
return 0;
}