Cod sursa(job #2228779)

Utilizator DumitrescuBogdanDumitrescu Bogdan DumitrescuBogdan Data 4 august 2018 19:04:31
Problema Al k-lea termen Fibonacci Scor 20
Compilator cpp Status done
Runda Arhiva educationala Marime 0.33 kb
#include <fstream>
#define Mod 666013
using namespace std;
ifstream f("kfib.in");
ofstream g("kfib.out");
int a,b,c,k;
int main()
{
    a=0;
    b=1;
    f>>k;
    k--;
    while(k)
    {
        c=a+b;
        a=b;
        b=c;
        c%=Mod;
        b%=Mod;
        a%=Mod;
        k--;
    }
    g<<c%Mod;
}