Cod sursa(job #532738)

Utilizator tudorsTudor Siminic tudors Data 12 februarie 2011 12:15:11
Problema Al k-lea termen Fibonacci Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.26 kb
#include <fstream>
using namespace std;
int n;
int x=0,y=1,z;

ifstream f("kfib.in");
ofstream g("kfib.out");

int main()
{
	f>>n;
	while (n)
	{
		z=(x+y)%666013;
		x=y;
		y=z;
		n--;
		n%=1332028;
	}
	g<<x;
	f.close();
	g.close();
	return 0;
}