Cod sursa(job #1295279)

Utilizator Bogdan.GhGheorghe Bogdan Bogdan.Gh Data 19 decembrie 2014 08:50:19
Problema Iepuri Scor 50
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.39 kb
#include<iostream>
#include<fstream>

using namespace std;

int main()
{
	int x,y,z,a,b,c,nr=0,S,T;
	long long n;
	ifstream f("iepuri.in");
	ofstream g("iepuri.out");
	f>>T;
	while(nr<T)
	{
		S=0;
		f>>x>>y>>z;
		f>>a>>b>>c;
		f>>n;
		for(int i=3;i<=n;i++)
		{
			S=(a*z+b*y+c*x)%666013;
			x=y;
			y=z;
			z=S;
		}
		g<<S<<endl;
		nr++;
	}
	g.close();
	return 0;
	
}