Cod sursa(job #651599)
Utilizator | Data | 20 decembrie 2011 21:58:41 | |
---|---|---|---|
Problema | Iepuri | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.36 kb |
#include<iostream>
#include<fstream>
using namespace std;
int main()
{
ifstream f("iepuri.in");
ofstream g("iepuri.out");
long long x,y,z,a,b,c,n,t,s;
f>>t;
for(int l=1; l<=t; l++)
{
f>>x>>y>>z>>a>>b>>c>>n;
s=0;
for(int i=1; i<=n-3; i++)
{
s=a*z+b*y+c*x;
x=y;
y=z;
z=s;
}
s=a*z+b*y+c*x;
g<<s%666013<<"\n";
}
}