Pagini recente » Cod sursa (job #3183520) | Cod sursa (job #2292295) | Cod sursa (job #2875182) | Cod sursa (job #357802) | Cod sursa (job #2863327)
#include <bits/stdc++.h>
#define uint unsigned int
using namespace std;
ifstream fin ("iepuri.in");
ofstream fout ("iepuri.out");
void test_case(){
int x, y, z;
int c, b, a;
int t, n;
fin>>x>>y>>z>>a>>b>>c>>n;
for(int i=3; i<=n; i++){
t = x * c + y * b + z * a;
x = y;
y = z;
z = t;
}
fout<<z<<"\n";
return;
}
signed main (){
ios_base::sync_with_stdio(false);
fin.tie(nullptr);
fout.tie(nullptr);
int teste;
fin>>teste;
while(teste--)
test_case();
return 0;
}