Cod sursa(job #2796588)
Utilizator | Data | 8 noiembrie 2021 15:13:31 | |
---|---|---|---|
Problema | Al k-lea termen Fibonacci | Scor | 20 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.24 kb |
#include <fstream>
using namespace std;
ifstream f("kfib.in"); ofstream g("kfib.out");
int k,F[10000005];
int main()
{ f>>k;
F[1]=1;
for(int i=2;i<=k; i++) F[i]=(F[i-1]+F[i-2])%666013;
g<<F[k]; g.close(); f.close(); return 0;
}