Cod sursa(job #302637)
Utilizator | Data | 9 aprilie 2009 09:26:13 | |
---|---|---|---|
Problema | Iepuri | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.31 kb |
#include<fstream.h>
long n,aux,x,y,z;
int a,b,c,t,i,j;
long main()
{ifstream f("iepuri.in");
ofstream g("iepuri.out");
f>>t;
for(i=1;i<=t;i++)
{f>>x>>y>>z>>a>>b>>c>>n;
for(j=1;j<=n-2;j++)
{aux=z*a+y*b+x*c;
x=y;
y=z;
z=aux;
aux=0;}
g<<z<<endl;
}
return 0;
f.close();
g.close();
}