Cod sursa(job #3158176)

Utilizator raizoSoare Antonio raizo Data 17 octombrie 2023 22:04:57
Problema Iepuri Scor 50
Compilator cpp-64 Status done
Runda Arhiva de probleme 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;
}