Cod sursa(job #703415)
Utilizator | Data | 2 martie 2012 12:17:38 | |
---|---|---|---|
Problema | Iepuri | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.34 kb |
#include<stdio.h>
int t,x,y,z,a,b,c,n,i;
int main()
{freopen ("iepuri.in","r",stdin);
freopen ("iepuri.out","w",stdout);
long j,st[100];
scanf("%d",&t);
for (i=1;i<=t;i++){
scanf("%d%d%d%d%d%d%ld",&x,&y,&z,&a,&b,&c,&n);
for (j=3;j<=n;j++){
st[j]=c*x+b*y+a*z;
x=y;y=z;z=st[j];}
st[n]=st[n]%666013;
printf("%ld\n",st[n]);}
return 0;}