Cod sursa(job #3157842)

Utilizator TonyyAntonie Danoiu Tonyy Data 16 octombrie 2023 22:38:02
Problema Iepuri Scor 0
Compilator cpp-64 Status done
Runda HLO 2023 - Cls 11-12 - Tema 0 Marime 0.48 kb
#include <fstream>
using namespace std;

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

long long 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 (long long j = 3 ; j <= n ; ++j)
        {
            s = a * z + b * y + c * x;
            x = y;
            y = z;
            z = s;
        }
        fout << s % 666013 << "\n";
    }
    return 0;
}