Cod sursa(job #1171998)
Utilizator | Data | 16 aprilie 2014 17:18:53 | |
---|---|---|---|
Problema | Al k-lea termen Fibonacci | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.3 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("kfib.in");
ofstream g("kfib.out");
long long n,t;
long long fib (long long x)
{
if (x < 3 ) return 1;
else return fib(x-2)+fib(x-1);
}
int main()
{
f>>n;
t=fib(n)%666013;
g << t << endl;
return 0;
}