标签:
1 #include<cstdio> 2 #include<cstring> 3 using namespace std; 4 int main() 5 { 6 long long t,n,m,z,l,a,sum; 7 scanf("%I64d",&t); 8 while (t--) 9 { 10 scanf("%I64d%I64d%I64d%I64d",&n,&m,&z,&l); 11 a=sum=0; 12 n-=1; 13 while (n--) 14 { 15 a=(m*a+z)%l; 16 sum^=a*2; 17 } 18 printf("%I64d\n",sum); 19 } 20 }
标签:
原文地址:http://www.cnblogs.com/pblr/p/4782993.html