Cod sursa(job #689023)
Utilizator | Data | 24 februarie 2012 08:14:45 | |
---|---|---|---|
Problema | Al k-lea termen Fibonacci | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.31 kb |
#include<stdio.h>
long long A[4],i,K;
int main()
{
freopen("kfib.in","r",stdin);
freopen("kfib.out","w",stdout);
scanf("%d",&K);
A[1]=0;
A[2]=1;
i=2;
printf("%d",K);
while(i<=K)
{
A[3]=(A[2]%666013)+(A[1]%666013);
A[1]=A[2];
A[2]=A[3];
i++;
}
printf("%d",A[3]);
return 0;
}