Cod sursa(job #555299)

Utilizator AndreiMihuAndrei Mihu AndreiMihu Data 15 martie 2011 13:34:02
Problema Iepuri Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.61 kb
#include<fstream.h>
ifstream f("iepuri.in");
ofstream g("iepuri.out");
long long n,r,a,b,c,aux1,aux2,nr,t,x,y,z,i;
int main()
{ f>>t;
  for(i=1;i<=t;i++) { f>>x>>y>>z>>a>>b>>c>>n;
                      nr=3;
                      while(nr<=n) { r=a*z+b*y+c*x;
					                nr++;
					                aux1=z;
									aux2=y;
                                    z=r;
                                    y=aux1;
                                    x=aux2;
                                  }
                      g<<r%666013<<"\n";
                    }
  f.close();
  g.close();
  return 0;
}