Cod sursa(job #120355)
| Utilizator | Data | 5 ianuarie 2008 09:54:10 | |
|---|---|---|---|
| Problema | Iepuri | Scor | 40 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.42 kb |
#include<iostream.h>
#include<stdio.h>
int main()
{ long n, w, x, y, z;
int a, b, c, t, i, j;
freopen("iepuri.in", "rt", stdin);
freopen("iepuri.out", "wt", stdout);
cin>>t;
for(i=1;i<=t;i++)
{ cin>>x>>y>>z>>a>>b>>c>>n;
x=x%666013;
y=y%666013;
z=z%666013;
for(j=3;j<=n;j++)
{ w=(c*x+b*y+a*z)%666013;
x=y;
y=z;
z=w;
}
cout<<z<<endl;
}
return 0;
}