Cod sursa(job #630095)
| Utilizator | Data | 4 noiembrie 2011 18:40:03 | |
|---|---|---|---|
| Problema | Al k-lea termen Fibonacci | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.25 kb |
#include<fstream>
using namespace std;
#define N (1332028)
#define Mod 666013
int K,z,a = 1,b = 0;
int main()
{
ifstream f("kfib.in");
ofstream g("kfib.out");
f >> K;
K --;
for(;K--%N;z = (a+b)%(Mod), b = a , a = z);
g << z;
}