Cod sursa(job #394310)

Utilizator sorecau_catalinSorecau Catalin sorecau_catalin Data 10 februarie 2010 19:14:08
Problema Al k-lea termen Fibonacci Scor 0
Compilator cpp Status done
Runda Arhiva educationala Marime 0.29 kb
#include <fstream>
#define MOD 666013
using namespace std;

ifstream fin("kfib.in");
ofstream fout("kfib.out");
int f[1000000];
int n;

int main()
{
	fin >> n;
	for ( int i = 2; i<=n;i++)
		f[i] = f[i-2]+f[i-1];
	fout << f[n] % MOD;
	fin.close();
	fout.close();
	return 0;
}