Cod sursa(job #53164)

Utilizator gabitzish1Gabriel Bitis gabitzish1 Data 21 aprilie 2007 12:53:03
Problema Iepuri Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.5 kb
#include<fstream.h>

long long aux, x, y, z, a, b, c, t;
long long n, contor;

void calcul()
{
  ifstream in("iepuri.in");
  ofstream out("ieputi.out");
  in>>t;
  for (int i=1; i<=t; i++)
    {
      contor=3;
      in>>x>>y>>z>>a>>b>>c>>n;
      while (contor<=n)
	{
	  contor++;
	  aux=x;
	  x=y%666013; y=z%666013;
	  z=((a*y)%666013+(b*x)%666013+(c*aux)%666013)%666013;
	}
      out<<z<<'\n';
    }
  out.close();
  in.close();
}

int main()
{
  calcul();
  return 0;
}