Cod sursa(job #447635)
Utilizator | Data | 29 aprilie 2010 17:46:47 | |
---|---|---|---|
Problema | Al k-lea termen Fibonacci | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.28 kb |
#include <cstdio>
const int M=666013;
int n;
void rez()
{
int x=0,y=1,z=0;
freopen("kfib.in","r",stdin);
freopen("kfib.out","w",stdout);
scanf("%d",&n);
while(n--%1332028)
{
z=(x+y)%M;
x=y;
y=z;
}
printf("%d",x);
}
int main()
{
rez();
return 0;
}