Pagini recente » Cod sursa (job #2506939) | Diferente pentru utilizator/sima_cotizo intre reviziile 44 si 28 | Monitorul de evaluare | Diferente pentru problema/expand intre reviziile 15 si 14 | Cod sursa (job #3157836)
#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;
}