Pagini recente » Diferente pentru problema/mugur intre reviziile 5 si 4 | Diferente pentru problema/critice2 intre reviziile 7 si 6 | Diferente pentru problema/cerc3 intre reviziile 6 si 7 | Arhiva de probleme | Cod sursa (job #3128421)
#include <bits/stdc++.h>
using namespace std;
ifstream fin("kfib.in");
ofstream fout("kfib.out");
int f1 = 0, f2 = 1, f3 = 0;
const int m = 666013;
int modulo(int k){
if(k == 0)
return 0;
if(k == 1)
return 1;
k = k - 1;
while(k--){
f3 = (f1+f2) % m;
f1 = f2;
f2 = f3;
}
return f3;
}
int main(){
int c;
fin >> c;
fout << modulo(c);
return 0;
}