Cod sursa(job #2344722)

Utilizator IonDragosIon Dragos IonDragos Data 15 februarie 2019 15:35:16
Problema Al k-lea termen Fibonacci Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.31 kb
#include <bits/stdc++.h>

using namespace std;

ifstream f("kfib.in");
ofstream g("kfib.out");
int MOD=666013;
int k,a=1,b=1, c;
int main()
{
    f>>k;
    k%=(2*666014);
    for(int i=3;i<=k;i++)
    {
        c=a+b;
        c%=MOD;
        a=b;
        b=c;
    }
    g<<c;
    return 0;
}