Cod sursa(job #1172053)
Utilizator | Data | 16 aprilie 2014 18:35:35 | |
---|---|---|---|
Problema | Al k-lea termen Fibonacci | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.34 kb |
#include<fstream>
#include<iostream>
using namespace std;
ifstream fin("kfib.in");
ofstream fout("kfib.out");
int x=0,y=1,z,k;
int main()
{
fin>>k;
k%=1332028;
for(int i=0;i<k;i++)
{
z = (x+y)%666013;
x = y;
y = z;
}
cerr<<x<<endl;
fout<<x<<endl;
return 0;
}