hdoj 5344 MZL's xor (简单异或)
来源:互联网 发布:淘宝里怎么找我的店铺 编辑:程序博客网 时间:2024/06/01 14:10
MZL's xor
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1264 Accepted Submission(s): 784
Problem Description
MZL loves xor very much.Now he gets an array A.The length of A is n.He wants to know the xor of all (Ai +Aj )(1≤i,j≤n )
The xor of an array B is defined asB1 xor B2 ...xor Bn
The xor of an array B is defined as
Input
Multiple test cases, the first line contains an integer T(no more than 20), indicating the number of cases.
Each test case contains four integers:n ,m ,z ,l
A1=0 ,Ai=(Ai−1∗m+z) mod l
1≤m,z,l≤5∗105 ,n=5∗105
Each test case contains four integers:
Output
For every test.print the answer.
Sample Input
23 5 5 76 8 8 9
Sample Output
1416
code
#include <iostream>#include<cstdio>using namespace std;#define MAXN 500010#define LL long longLL a[MAXN];int main(){ int t,m,n,z,l; scanf("%d",&t); while(t--) { scanf("%d%d%d%d",&n,&m,&z,&l); a[1]=0; for(int i=2;i<=n;i++) { a[i]=(a[i-1]*m+z)%l; } long long ans=0; for(int i=1;i<=n;i++) { ans=ans^(2*a[i]); } printf("%lld\n",ans); } return 0;}
0 0
- hdoj 5344 MZL's xor (简单异或)
- hdoj MZL's xor 5344 (异或)
- 【HDU 5344 MZL's xor】+ 异或
- hdoj 5433 MZL's xor ( 异或性质)
- HDOJ 5344 MZL's xor 【math】
- 其他-HDOJ-5344-MZL's xor
- HDOJ-----5344---MZL's xor---思维
- HDU 5344 MZL's xor(异或运算)
- B - MZL's xor -水题-异或操作规律
- HDU 5344 MZL's xor
- HDU 5344 MZL's xor
- hdu 5344 MZL's xor
- hdu 5344 MZL's xor
- HDU 5344 MZL's xor
- Hdu-5344 MZL's xor
- HDU 5344 MZL's xor
- HDU 5344 MZL's xor (异或运算的性质)
- HDU 5344(MZL's xor-(ai+aj)的异或和)
- MFC 之进度条CProgressCtrl
- 【iOS学习】十四、对象方法与类方法
- C++字符串变量作为函数形参传递(引用方式)
- HTTP协议的主要特点
- 《Spark商业案例与性能调优实战100课》第32课:彻底解密Spark 2.1.X中Shuffle 下Task视角内存分配管理
- hdoj 5344 MZL's xor (简单异或)
- 如何在Ubuntu系统下安装pycharm
- pcl1.7.2(32位)+vs2012的配置
- 贝叶斯理论
- JavaBean的使用
- DNS及DDNS
- getSimpleName(),getClass(),getGenericSuperclass()和getActualTypeArguments()的返回结果
- Android样式的抽取使用与国际化(中英双语)
- Postgresql用户密码过期的解决(一)