您的位置:首页 > 其它

hdu 5344 MZL's xor (15多校第五场1002)

2015-08-05 20:40 274 查看
//多校第五场1002
//hdu 5344
//(Ai+Aj)^(Aj+Ai)=0
//sigma^(2*Ai);
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
#include<vector>
using namespace std;
const long long mod=1e9+7;
typedef long long LL;
int main(){
int T;
scanf("%d",&T);
while(T--){
int n,m,l,z;
scanf("%d%d%d%d",&n,&m,&z,&l);
long long pre=0;
LL tot=0;
for(int i=2;i<=n;i++){
long long now=((LL)pre*m+z)%l;
tot^=(2*now);
pre=now;
}
printf("%lld\n",tot);

}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: