Cod sursa(job #237340)
Utilizator | Data | 29 decembrie 2008 16:30:32 | |
---|---|---|---|
Problema | Iepuri | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.37 kb |
#include <stdio.h>
int main()
{
freopen("iepuri.in","r",stdin);
freopen("iepuri.out","w",stdout);
long long x,y,z,a,b,c,n,t,i,j,sch;
scanf("%lld",&t);
for (i=1; i<=t; i++)
{
scanf("%lld%lld%lld%lld%lld%lld%lld",&x,&y,&z,&a,&b,&c,&n);
while (n-2)
{
sch=z;
z=z*a+y*b+x*c;
x=y;
y=sch;
n--;
}
printf("%d\n",z%666013);
}
return 0;
}