Pagini recente » Cod sursa (job #704863) | Cod sursa (job #1687473) | Cod sursa (job #1471417) | Cod sursa (job #562032) | Cod sursa (job #2139100)
#include<iostream>
#include<fstream>
using namespace std;
ifstream fin("kfib.in");
ofstream fout("kfib.out");
int main() {
long long cterm = 1, aterm = 1;
long long k; fin >> k;
if (k == 1 || k == 2) {
fout << 1;
}
else {
k -= 2;
long long aux;
while (k > 0) {
aux = cterm % 666013;
cterm = (cterm + aterm) % 666013;
aterm = aux;
k--;
}
fout << cterm;
}
return 0;
}