Cod sursa(job #1605015)
Utilizator | Data | 18 februarie 2016 18:46:56 | |
---|---|---|---|
Problema | Iepuri | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.57 kb |
#include <iostream>
#include <fstream>
using namespace std;
long x,y,z,a,b,c,n,i,aux1,aux2,j,q;
int main()
{
ifstream f("iepuri.in");
ofstream g("iepuri.out");
f>>q;
for(j=1;j<=q;j++)
{
f>>x;
f>>y;
f>>z;
f>>a;
f>>b;
f>>c;
f>>n;
for(i=3;i<=n;i++)
{
aux1=z;
aux2=y;
z=a*z+b*y+c*x;
if(z==0)
z=aux1;
y=aux1;
x=aux2;
}
g<<z%666013<<endl;
}
return 0;
}