Cod sursa(job #3158199)

Utilizator raizoSoare Antonio raizo Data 17 octombrie 2023 23:16:33
Problema Iepuri Scor 50
Compilator cpp-64 Status done
Runda HLO 2023 - Cls 11-12 - Tema 0 Marime 0.5 kb
#include <fstream>
using namespace std;

ifstream cin("iepuri.in");
ofstream cout("iepuri.out");

int MOD = 666013;

int func() {
    int x, y, z, a, b, c, n, aux;
    cin >> x >> y >> z >> a >> b >> c >> n;
    for (int i = 2; i < n; i++) {
        aux = (z * a + y * b + x * c)%MOD;
        x = y;
        y = z;
        z = aux;
    }
    return z;
}

int main()
{
    int n,result;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        result = func();
        cout << result << "\n";
    }
    return 0;
}