Cod sursa(job #3157836)
Utilizator | Data | 16 octombrie 2023 22:27:01 | |
---|---|---|---|
Problema | Iepuri | Scor | 0 |
Compilator | cpp-64 | Status | done |
Runda | HLO 2023 - Cls 11-12 - Tema 0 | Marime | 0.46 kb |
#include <fstream>
using namespace std;
ifstream fin ("iepuri.in");
ofstream fout("iepuri.out");
int x, y, z, a, b, c, n, t, s;
int main()
{
fin >> t;
for (int i = 1 ; i <= t ; ++i)
{
fin >> x >> y >> z >> a >> b >> c >> n;
for (int j = 3 ; j <= n ; ++j)
{
s = a * z + b * y + c * x;
x = y;
y = z;
z = s;
}
fout << s << "\n";
}
return 0;
}