Cod sursa(job #3286042)

Utilizator Ruxandra009Ruxandra Vasilescu Ruxandra009 Data 13 martie 2025 17:59:58
Problema Iepuri Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.54 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 = ((1LL * c * x) % mod + (1LL * b * y) % mod + (1LL * a * z) % mod) % mod;
        a = b; b = c; c = d;
    }

    g << c << '\n';
}

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