Cod sursa(job #792849)
Utilizator | Data | 1 octombrie 2012 00:12:10 | |
---|---|---|---|
Problema | Al k-lea termen Fibonacci | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.38 kb |
#include <fstream>
#include <iostream>
using namespace std;
const int HELL = 666013;
ifstream fin("kfib.in");
ofstream fout("kfib.out");
int main(int argc, char const *argv[])
{
int k;
fin >> k;
k = 2707124;
long long a = 1, b = 0, aux;
for (int i = 1; i < k; ++i) {
aux = a + b;
b = a;
a = aux % HELL;
}
fout << a;
return 0;
}