Cod sursa(job #1295278)
Utilizator | Data | 19 decembrie 2014 08:29:45 | |
---|---|---|---|
Problema | Iepuri | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.4 kb |
#include<iostream>
#include<fstream>
using namespace std;
int main()
{
int x,y,z,a,b,c,nr=0,S,T;
long long n;
ifstream f("iepuri.in");
ofstream g("iepuri.out");
f>>T;
while(nr<T)
{
S=0;
f>>x>>y>>z;
f>>a>>b>>c;
f>>n;
for(int i=3;i<=n;i++)
{
S=a*z+b*y+c*x;
x=y;
y=z;
z=S;
if(i<n)
S=0;
}
g<<S<<endl;
nr++;
}
g.close();
return 0;
}