Cod sursa(job #2745595)
Utilizator | Data | 26 aprilie 2021 20:21:11 | |
---|---|---|---|
Problema | Al k-lea termen Fibonacci | Scor | 20 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.28 kb |
#include <bits/stdc++.h>
#define MOD 666013
using namespace std;
ifstream fin ("kfib.in");
ofstream fout("kfib.out");
int x, y =1, z, k;
int main(){
fin >> k;
while (k--){
z = (x + y) % MOD;
x = y, y = z;
}
fout << x;
return 0;
}