Cod sursa(job #3253085)

Utilizator tolickAnatol tolick Data 1 noiembrie 2024 12:54:24
Problema Al k-lea termen Fibonacci Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.32 kb
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
    ifstream fin("kfib.in");
    ofstream fout("kfib.out");
    int x = 0, y = 1, z, k;
    fin >> k;
    while (k-- % 1332028)
        z = (x + y) % 666013, x = y, y = z;
    fout << x << endl;
    fin.close();
    fout.close();
}