Cod sursa(job #3269648)

Utilizator MagicoWizardDacinoi Darius MagicoWizard Data 20 ianuarie 2025 10:43:59
Problema Iepuri Scor 50
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.47 kb
#include <fstream>

using namespace std;

ifstream f("iepuri.in");
ofstream g("iepuri.out");

int main()
{
    int T, x, y, z, a, b, c, n, nr;
    f >> T;
    for (int nu = 1; nu <= T; nu++)
    {
        f >> x >> y >> z >> a >> b >> c >> n;
        for (int i = 3; i <= n; i++)
        {
            nr = (a * z + b * y + c * x) % 666013;
            x = y;
            y = z;
            z = nr;
        }
        g << z << '\n';
    }
    return 0;
}