Cod sursa(job #2863327)

Utilizator BlueLuca888Girbovan Robert Luca BlueLuca888 Data 6 martie 2022 16:20:12
Problema Iepuri Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.59 kb
#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;
}