Cod sursa(job #2227986)
| Utilizator | Data | 2 august 2018 13:32:14 | |
|---|---|---|---|
| Problema | Al k-lea termen Fibonacci | Scor | 20 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.3 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream fin("kfib.in");
ofstream fout("kfib.out");
int main()
{
int k, a=0, b=1, c;
fin >> k;
k--;
while(k){
c = a + b;
c %= 666013;
a = b;
b = c;
k --;
}
fout << c;
return 0;
}
