Pagini recente » Cod sursa (job #2858371) | Cod sursa (job #2419243)
#include <iostream>
#include <fstream>
#define MOD 666013
using namespace std;
ifstream f("iepuri.in");
ofstream g("iepuri.out");
int t,a,b,c,n;
int Aflare(int k,int x, int y, int z)
{
if(k==n+1)
return ((z*a+y*b+x*c)%MOD);
else
return Aflare(k+1,y,z,(z*a+y*b+x*c)%MOD);
}
void Citire()
{f>>t;
while(t)
{t--;
int x,y,z;
f>>x>>y>>z>>a>>b>>c>>n;
//g<<a<<b<<c<<x<<y<<z;
if(n==1)
g<<x<<endl;
else
if(n==2)
g<<y<<endl;
else
if(n==3)
g<<z<<endl;
else
{
g<<Aflare(4,a,y,z);
g<<endl;
}
}
}
int main()
{Citire();
cout << "Hello world!" << endl;
return 0;
}