Cod sursa(job #2238176)
Utilizator | Data | 4 septembrie 2018 19:38:58 | |
---|---|---|---|
Problema | Al k-lea termen Fibonacci | Scor | 20 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.27 kb |
#include <fstream>
using namespace std;
ifstream f("kfib.in");
ofstream g("kfib.out");
//const int N = 1000000001;
int n,i;
long long v[10000001];
int main()
{f>>n;
v[1]=v[2]=1;
for(i=3;i<=n;i++)
v[i]=(v[i-1]+v[i-2])%666013;
g<<v[n];
return 0;
}