Cod sursa(job #357333)
Utilizator | Data | 18 octombrie 2009 20:56:55 | |
---|---|---|---|
Problema | Iepuri | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.46 kb |
#include <fstream.h>
ifstream f("iepuri.in");
ofstream g("iepuri.out");
int t,n,x,y,z,v[1000],i,a,b,c,j;
int main()
{
f>>t;
for(i=1;i<=t;i++) { f>>x>>y>>z>>a>>b>>c>>n;
v[0]=x;
v[1]=y;
v[2]=z;
for(j=3;j<=n;j++) v[j]=v[j-1]*a+v[j-2]*b+v[j-3]*c;
g<<v[n]<<"\n";
}
f.close();
g.close();
return 0;
}