Cod sursa(job #663968)
Utilizator | Data | 19 ianuarie 2012 12:50:46 | |
---|---|---|---|
Problema | Al k-lea termen Fibonacci | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.26 kb |
#include <fstream>
using namespace std;
ifstream f("kfib.in");
ofstream g("kfib.out");
long long k,x,y,aux;
int i;
int main ()
{
f>>k;
k=k%(2*666013+2);
x=1;y=1;
for (i=3;i<=k;i++)
{
aux=x;
x=y;
y=(aux +x)%666013;
}
g<<y<<'\n';
return 0;
}