Pagini recente » Cod sursa (job #1537526) | Cod sursa (job #647577) | Cod sursa (job #870118) | Diferente pentru problema/puncte4 intre reviziile 9 si 8 | Cod sursa (job #1922367)
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin ("fibonacci.in");
ofstream fout ("fibonacci.out");
int x, y, z, i, n;
int main() {
fin >> n;
x = 0;
y = 1;
if (n == 0) {
fout << 0;
}
else if (n == 1) {
fout << 1;
}
else {
for (i = 2; i <= n % 1332028; i++) {
z = (x + y) % 666013;
x = y;
y = z;
}
fout << z;
}
return 0;
}