Cod sursa(job #1959342)

Utilizator shantih1Alex S Hill shantih1 Data 9 aprilie 2017 13:20:13
Problema Iepuri Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.42 kb
#include <iostream>
#include <fstream>

using namespace std;

int x, y, z, a, b, c, t, i, j, mod, y2, x2;
long long n;

int main () {
	
	ifstream fin("iepuri.in");
	ofstream fout("iepuri.out");
	
	mod = 666013;
	
	fin >> t;
	for (j = 1; j <= t; j++)
	{
		fin >> x >> y >> z >> a >> b >> c >> n;
		
		for (i = 1; i <= n-2; i++)
		{
			x2 = x;		y2 = y;
			x = y;
			y = z;
			z = a*z + b*y2 + c*x2;
		}
		fout << z << "\n";
	}
	
}