Cod sursa(job #2512619)

Utilizator Cosmin3105Cosmin Colceru Cosmin3105 Data 21 decembrie 2019 12:24:54
Problema Iepuri Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.67 kb
#include <iostream>
#include <fstream>

using namespace std;

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

int main()
{
    int t;
    fin >> t;
    for(int i = 1; i <= t; i++){
        long long x, y, z, a, b, c, n;
        fin >> x >> y >> z >> a >> b >> c >> n;

        for(int j = 1; j <= n - 2; j++){
            long long p = z * a + y * b + x * c;
            long long aux;
            aux = z;
            z = p;
            p = aux;

            aux = y;
            y = p;
            p = aux;

            aux = x;
            x = p;
            p = aux;
        }

        fout << z % 666013 << "\n";
    }

    return 0;
}