Cod sursa(job #1718125)

Utilizator NecoaraGabrielNecoara Gabriel-Stefan NecoaraGabriel Data 16 iunie 2016 17:52:59
Problema Al k-lea termen Fibonacci Scor 0
Compilator cpp Status done
Runda Arhiva educationala Marime 0.39 kb



#include<iostream>
#include<fstream>

using namespace std;
long long fib(long long f1,long long f2,long long k,long long start)
{
    //long long f3;
    if(start != k)
        return fib(f2,f1+f2%666013,k,start+1);
    return f1+f2;

}

ifstream f("kfib.in");
ofstream g("kfib.out");
int main()
{

    long long k;
    f>>k;

    g<<fib(1,1,k,3);
    return 0;
}