Pagini recente » Cod sursa (job #2915312) | Cod sursa (job #1274697) | Cod sursa (job #2825409) | Cod sursa (job #2510488) | Cod sursa (job #2512617)
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("iepuri.in");
ofstream fout("iepuri.out");
int main()
{
int t;
fin >> t;
for(int i = 1; i <= t; i++){
int x, y, z, a, b, c, n;
fin >> x >> y >> z >> a >> b >> c >> n;
for(int j = 1; j <= n - 2; j++){
int p = z * a + y * b + x * c;
int aux;
aux = z;
z = p;
p = aux;
aux = y;
y = p;
p = aux;
aux = x;
x = p;
p = aux;
}
fout << z << "\n";
}
return 0;
}