Cod sursa(job #407147)
Utilizator | Data | 2 martie 2010 09:00:06 | |
---|---|---|---|
Problema | Iepuri | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.43 kb |
#include<fstream>
using namespace std;
int main()
{
ifstream f("iepuri.in");
ofstream g("iepuri.out");
long n;
f>>n;
long x,y,z,i,a,b,c;
long ziuaproblema;
for(i=1;i<=n;i++)
{
f>>x>>y>>z>>a>>b>>c>>ziuaproblema;
long zi=2;
while(zi<ziuaproblema)
{
x=a*z+b*y+c*x;
zi++;
long aux=x;
x=y;
y=z;
z=aux;
}
g<<(long)(z%666013)<<endl;
}
g.close();
f.close();
return 0;
}