Cod sursa(job #3158083)

Utilizator andrei76Diaconescu Andrei andrei76 Data 17 octombrie 2023 17:52:09
Problema Iepuri Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.54 kb
#include <iostream>
#include <fstream>

using namespace std;

int main()
{
    unsigned long long int x, y, z;
    int a, b, c, n, t, i, j;
    ifstream fin("iepuri.in");
    ofstream fout("iepuri.out");
    fin>>t;
    for(i = 1; i <= t; i++){
        fin>>x>>y>>z>>a>>b>>c>>n;
        unsigned long long int goku;
        for(j = 3; j <= n; j++){
            goku = a*z + b*y + c*x;
            x = y;
            y = z;
            z = goku;
        }
        fout<<goku%666013<<"\n";
        fout.flush();
    }
    return 0;
}