Pagini recente » Cod sursa (job #2463900) | Cod sursa (job #516307) | Cod sursa (job #889394) | Cod sursa (job #1325133) | Cod sursa (job #108055)
Cod sursa(job #108055)
#include <stdio.h>
long long n, a, b, x, y, z, t1, t2, t3, m, contor;
int main()
{
freopen("rsir.in","r",stdin);
freopen("rsir.out","w",stdout);
scanf("%lld %lld %lld %lld %lld %lld %lld %lld %lld",&t1,&t2,&a,&b,&x,&y,&z,&m,&n);
contor=1;
while (contor<n)
{
t3= (((a%m)*(t1%m)*(t1%m))%m + ((b%m)*((t2%m)*(t2%m)))%m + ((x%m)*(t1%m)%m) + ((y%m)*(t2%m))%m + z)%m;
contor++;
if (contor == n) printf("%lld",t3);
t1=t2;
t2=t3;
}
return 0;
}