Cod sursa(job #1920631)

Utilizator CostinteoGrigore Costin Teodor Costinteo Data 10 martie 2017 08:48:14
Problema Al k-lea termen Fibonacci Scor 20
Compilator cpp Status done
Runda Arhiva educationala Marime 0.28 kb
#include <fstream>

using namespace std;

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