Cod sursa(job #474049)

Utilizator aurelian121bonte aurelian aurelian121 Data 2 august 2010 10:24:37
Problema Iepuri Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.38 kb
#include <iostream>
#include <fstream>
using namespace std;
ofstream g("iepuri.out");
int x[10000000],a,b,c,v[100],n,t,i,j,s;
int main ()
{
	ifstream f("iepuri.in");
	f>>t;
	for(i=1;i<=t;i++)
	{
		f>>x[0]>>x[1]>>x[2];
		f>>a>>b>>c;
		f>>n;
		for(j=3;j<=n;j++)
		{	x[j]=x[j-1]*a+x[j-2]*b+x[j-3]*c;
		}
	g<<x[j-1]%666013<<endl;
	}
	f.close();
	g.close();
	return 0;
}