Cod sursa(job #1872187)
Utilizator | Data | 7 februarie 2017 23:38:17 | |
---|---|---|---|
Problema | Al k-lea termen Fibonacci | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.23 kb |
#include <fstream>
using namespace std;
ifstream fin("kfib.in");
ofstream fout("kfib.out");
int main()
{int x=0,y=1,z,k;
fin>>k;
while(k--%1332028)
{
z=(x+y)%666013;
x=y;
y=z;
}
fout<<x;
return 0;
}