Cod sursa(job #28874)
Utilizator | Data | 8 martie 2007 13:40:09 | |
---|---|---|---|
Problema | Iepuri | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.34 kb |
#include<fstream.h>
ifstream f("iepuri.in");
ofstream g("iepuri.out");
int x,y,z,a,b,c,i,t,j,r,n;
long nr;
void main()
{f>>t;
for(j=1;j<=t;j++)
{f>>x>>y>>z>>a>>b>>c>>n;
nr=z;
for(i=3;i<=n;i++)
{nr=(a*z)+(b*y)+(c*x);
x=y;
y=z;
z=nr;}
r=nr%666013;
g<<r<<endl;}
f.close();
g.close();}