Pagini recente » Cod sursa (job #3136835) | Cod sursa (job #3199150) | Cod sursa (job #1454510) | Cod sursa (job #1139605) | Cod sursa (job #86923)
Cod sursa(job #86923)
#include<stdio.h>
long long aux, x, y, z, a, b, c, t;
long long n, contor;
void calcul()
{
freopen("iepuri.in","r",stdin);
freopen("iepuri.out","w",stdout);
scanf("%lld",&t);
int i;
for (i=1; i<=t; i++)
{
contor=3;
scanf("%lld%lld%lld%lld%lld%lld%lld",&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;
}
printf("%lld\n",z);
}
}
int main()
{
calcul();
return 0;
}