Cod sursa(job #3286064)

Utilizator Ruxandra009Ruxandra Vasilescu Ruxandra009 Data 13 martie 2025 18:24:25
Problema Iepuri Scor 40
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.52 kb
#include <fstream>
#include <vector>
#include <string>

using namespace std;

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

const int mod = 666013;

void solv()
{
    int x, y, z, a, b, c, n;
    f >> x >> y >> z >> a >> b >> c >> n;

    for(int i = 3; i <= n; i ++)
    {
        int d = ((z * a) % mod + (y * b) % mod + (x * c) % mod) % mod;
        x = y; y = z; z = d;
    }

    g << z << '\n';
}

int main()
{
    int t; f >> t;
    for(; t >= 1; t --)
        solv();
    return 0;
}