MZL's xor
MZL's xor
Time Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/65536K (Java/Other)
Total Submission(s) : 1 Accepted Submission(s) : 1
The xor of an array B is defined as $B_1$ xor $B_2$...xor $B_n$
#include<stdio.h>
#include<string.h>
const int MAXN=*1e5+;
long long A[MAXN],B[MAXN];
int main(){
int T,n,m,z,l;
scanf("%d",&T);
while(T--){
scanf("%d%d%d%d",&n,&m,&z,&l);
A[]=;
long long ans=;
for(int i=;i<n;i++){
A[i]=(A[i-]%l*m%l+z%l)%l;
B[i]=A[i]+A[i];//因为相同的元素异或结果为0;所以A[i]+A[j] | A[j]+A[i]等于0;只剩相同元素之和的异或;
ans^=B[i];
}
printf("%lld\n",ans);
}
return ;
}
MZL's xor的更多相关文章
- hdu5344 MZL's xor(水题)
转载请注明出处: http://www.cnblogs.com/fraud/ ——by fraud MZL's xor Time Limit: 2000/1000 MS (Java/ ...
- hdu 5344 MZL's xor(数学之异或)
Problem Description MZL loves xor very much.Now he gets an array A.The length of A ≤i,j≤n) The xor ...
- hdu 5344 MZL's xor
MZL's xor Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total S ...
- HDU 5344 MZL's xor (多校)[补7月28]
MZL's xor Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total S ...
- HDU 5344 MZL's xor (水题)
题意:给一个序列A,设序列B的中的元素有(Ai+Aj)(1≤i,j≤n),那么求B中所有元素的异或之和.而序列A是这样来的:A1=0,Ai=(Ai−1∗m+z) mod l. 思路:相同的元素异或结果 ...
- hdoj 5344 MZL's xor
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=5344 #include<stdio.h> #include<cstring> ...
- HDU 5344(MZL's xor-(ai+aj)的异或和)
MZL's xor Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total ...
- 2015 多校联赛 ——HDU5344(水)
Problem Description MZL loves xor very much.Now he gets an array A.The length of A is n.He wants to ...
- [LeetCode] Maximum XOR of Two Numbers in an Array 数组中异或值最大的两个数字
Given a non-empty array of numbers, a0, a1, a2, … , an-1, where 0 ≤ ai < 231. Find the maximum re ...
随机推荐
- 第6章 堆排序,d叉堆,优先队列
#include<stdio.h> #include<stdlib.h> #include<string.h> #define leftChild(i) (2*(i ...
- 【Chromium中文文档】插件架构
插件架构 转载请注明出处:https://ahangchen.gitbooks.io/chromium_doc_zh/content/zh//General_Architecture/Plugin_A ...
- 一些User-Agent
"Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)", "Mozilla/4.0 (compatible; MSIE ...
- git创建标签
创建标签 在Git中打标签非常简单,首先,切换到需要打标签的分支上: $ git branch * dev master $ git checkout master Switched to branc ...
- 在 Windows Azure 虚拟机中如何备份和还原 Windows 系统磁盘
备份和还原对于操作真实的系统来说至关重要.对于 Windows Azure 虚拟机环境中的 Windows Server,可以根据自身的需求选择多种不同的工具或将这些工具结合使用来实现备份.下面将对这 ...
- [置顶] Oracle GoldenGate 常见问题:长事务处理
长事务的影响 OGG是基于事务级的实时复制工具,也就是说OGG只复制已提交的事务,在遇到事务的commit或rollback之前,它会将每个事务的操作存储在称为cache的托管虚拟内存池中.内存再大也 ...
- 【HTML5】DOMContentLoaded事件
这个事件是从HTML中的onLoad的延伸而来的,当一个页面完成加载时,初始化脚本的方法是使用load事件,但这个类函数的缺点是仅在所有资源都完全加载后才被触发,这有时会导致比较严重的延迟,开发人员随 ...
- oracle添加用户及权限
CREATE USER qdcenter 用户名 IDENTIFIED BY qdcenter 密码 DEFAULT TABLESPACE data1 默认表空间 TEMPORARY TABLE ...
- SQL练习之求解填字游戏
SELECT * FROM dbo.spt_values
- MATLAB一句总结
MATLAB使用过程中的一些小总结: 1.sqrt函数的输入参数应为double类型: 2.im2bw把图像转换为二值图像: 3.double类型的图片必须转换为uint8类型后才能用imshow显示 ...