Cod sursa(job #781305)
Utilizator | Andreea Dutulescu andreeainfo_d | Data | 24 august 2012 09:35:22 |
---|---|---|---|
Problema | Al k-lea termen Fibonacci | Scor | 20 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.27 kb |
using namespace std;
#include<stdio.h>
int a,b,c,k,i;
int main()
{
freopen("kfib.in","r",stdin);
freopen("kfib.out","w",stdout);
scanf("%d",&k);
a=0;
b=1;
for(i=2;i<=k;i++)
{
c=a+b;
c=c%666013;
a=b;
b=c;
}
printf("%d\n",c);
return 0;
}