Mai intai trebuie sa te autentifici.
Cod sursa(job #2796598)
Utilizator | Data | 8 noiembrie 2021 15:30:43 | |
---|---|---|---|
Problema | Al k-lea termen Fibonacci | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.3 kb |
#include <fstream>
using namespace std;
ifstream f("kfib.in"); ofstream g("kfib.out");
int k,a[1400001];
int main()
{ f>>k;
a[1]=a[2]=1;
int i=2;
while(!(a[i]==1 && a[i-1]==0)) {i++; a[i]=(a[i-1]+a[i-2])%666013;}
int per=i-1;
g<<a[k%per]; g.close(); f.close(); return 0;
}