Cod sursa(job #2863329)

Utilizator BlueLuca888Girbovan Robert Luca BlueLuca888 Data 6 martie 2022 16:21:51
Problema Iepuri Scor 40
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.66 kb
#include <bits/stdc++.h>
#define uint unsigned int

using namespace std;

ifstream fin  ("iepuri.in");
ofstream fout ("iepuri.out");

const int MOD = 666013;

void test_case(){
    int x, y, z;
    int c, b, a;
    int t, n;

    fin>>x>>y>>z>>a>>b>>c>>n;
    for(int i=3; i<=n; i++){
        t = ((long long)x * c + (long long)y * b + (long long)z * a) % MOD;
        x = y;
        y = z;
        z = t;
    }
    fout<<z<<"\n";
    return;
}

signed main (){
    ios_base::sync_with_stdio(false);
    fin.tie(nullptr);
    fout.tie(nullptr);

    int teste;
    fin>>teste;
    while(teste--)
        test_case();
    return 0;
}