Cod sursa(job #1395179)

Utilizator Vikt0RTudose Victor Vikt0R Data 21 martie 2015 09:43:24
Problema Iepuri Scor 20
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.38 kb
#include <fstream>
using namespace std;
int main()
{long long x,y,z,a,b,c,n,aux,i,q,t;
ifstream A("iepuri.in");
ofstream B("iepuri.out");
A>>t;
for(q=1;q<=t;q++)
{
    A>>x>>y>>z>>a>>b>>c>>n;
    for(i=3;i<=n;i++)
    {
        aux=z%666013;
        z=(a*z+b*y+c*x)%666013;
        x=y%666013;
        y=aux;
    }
    B<<z<<endl;
}
A.close();
B.close();
return 0;
}