Cod sursa(job #2571329)

Utilizator Alex2421Nedelcu Alexandru Alex2421 Data 4 martie 2020 22:21:27
Problema Iepuri Scor 40
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.49 kb
#include <bits/stdc++.h>

using namespace std;

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

int t,a,b,c;
int x,y,z,n;

int main()
{
    in>>t;
    for(int i=1;i<=t;i++)
    {
        long long nw=0;
        in>>a>>b>>c;
        in>>x>>y>>z;
        in>>n;
        n=n-2;
        while(n>0)
        {
            nw=(1LL*c*x+1LL*b*y+1LL*a*z)%666013;
            a=b;
            b=c;
            c=nw;
            n--;
        }
        out<<nw<<'\n';
    }
}