Cod sursa(job #719520)
Utilizator | Data | 21 martie 2012 20:51:19 | |
---|---|---|---|
Problema | Al k-lea termen Fibonacci | Scor | 20 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.28 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("kfib.in");
ofstream g("kfib.out");
int f1;
int f2 = 1;
int f_nou;
int main()
{
int N;
f>>N;
while(N)
{
f_nou = (f2 + f1) % 666013;
f1 = f2;
f2 = f_nou;
N--;
}
g<<f1;
}