Cod sursa(job #585055)

Utilizator dutzulBodnariuc Dan Alexandru dutzul Data 27 aprilie 2011 21:42:10
Problema Iepuri Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.47 kb
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("iepuri.in");
ofstream g("iepuri.out");
int a,b,c,x,y,z,xx1,zz1,yy1,j,n,p,i,s,t;
int main()
{
 f>>t;
 for  (i=1;i<=t;i++)
    {
     f>>x>>y>>z>>a>>b>>c>>n;
     xx1=x;
     yy1=y;
     zz1=z;
     s=0;
     for (j=3;j<=n;j++)
     {
      s=xx1*c+yy1*b+zz1*a;
      xx1=yy1;
      yy1=zz1;
      zz1=s;
     }
     g<<s%666013<<'\n';
    }
   f.close();
   g.close();
    return 0;
}