Cod sursa(job #2914958)

Utilizator Deleanu_LucaDeleanu Luca Deleanu_Luca Data 21 iulie 2022 14:27:54
Problema Iepuri Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.41 kb
#include <bits/stdc++.h>

using namespace std;

ifstream fin("iepuri.in");
ofstream fout("iepuri.out");

int x,y,z,a,b,c,n,nrc,t,i,j;

int main()
{
    fin>>t;
    for(int i=1; i<=t; i++)
    {
        fin>>x>>y>>z>>a>>b>>c>>n;
        for(j=3; j<=n; j++)
        {
            nrc=a*z+b*y+c*x;
            x=y;
            y=z;
            z=nrc;
        }
        fout<<nrc<<'\n';
    }
}