Cod sursa(job #3286028)

Utilizator Ruxandra009Ruxandra Vasilescu Ruxandra009 Data 13 martie 2025 17:49:02
Problema Iepuri Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.46 kb
#include <fstream>
#include <vector>
#include <string>

using namespace std;

ifstream f("iepuri.in");
ofstream g("iepuri.out");

void solv()
{
    int x, y, z, a, b, c, n;
    f >> x >> y >> z >> a >> b >> c >> n;

    for(int i = 3; i <= n; i ++)
    {
        int d = c * x + b * y + a * z;
        a = b; b = c; c = d;
    }

    g << c << '\n';
}

int main()
{
    int t; f >> t;
    for(; t >= 1; t --)
        solv();
    return 0;
}