Cod sursa(job #2443288)
Utilizator | Data | 27 iulie 2019 12:38:18 | |
---|---|---|---|
Problema | Iepuri | Scor | 0 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.47 kb |
#include <fstream>
using namespace std;
ifstream fin("iepuri.in");
ofstream fout("iepuri.out");
int n,t,a,b,c,j;
long long x,y,z,s;
int main()
{
fin>>t;
for(int i = 1;i <= t;i++)
{
fin>>x>>y>>z>>a>>b>>c>>n;
int j = 0;
while(j <= n - 3)
{
s = a * z + b * y + c * x;
x = y;
y = z;
z = s;
j++;
}
fout<<s<<'\n';
}
return 0;
}