Pagini recente » Cod sursa (job #1353968) | Cod sursa (job #3212966) | Cod sursa (job #1351848) | Cod sursa (job #2400467) | Cod sursa (job #2399664)
#include <cstdio>
char F[2][201];
int main(){
FILE*fi;
fi=fopen("nunta.in","r");
short n;
fscanf(fi,"%hd", &n);
fclose(fi);
fi=fopen("nunta.out","w");
if(n == 1){
fprintf(fi,"1");
return 0;
}
F[0][1] = 1;
F[1][1] = 2;
unsigned char i, t;
short j;
for(j = 3; j <= n; j++){
t = 0;
for(i = 1; i <= 199 || t; i++, t/=10)
F[1 - j % 2][i] = (t += F[0][i] + F[1][i]) % 10;
}
i = 199;
while(F[1 - n % 2][i] == 0) i--;
while(i > 0)
fputc(F[1 - n % 2][i--] + '0', fi);
return 0;
}