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 ...
随机推荐
- IS--A与 Has-a 区别
- 解决apache启动问题:httpd: Could not reliably determine the server's fully
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for Se ...
- 如何将js与HTML完全脱离
先举出一个例子: var sound='Roar!'; function myOrneryBeast(){ alert(this); this.style.color='green';//this指代 ...
- OpenCV学习 2:播放AVI视频
原创文章,欢迎转载,转载请注明出处 第二个程序,播放视频.用opencv做起来是如此的简单..哈哈. 学Opencv,只是为了在它的基础上实现工程应用,而它里面高深的理论我等屌丝只 ...
- 16.java.lang.InterruptedException
java.lang.InterruptedException 被中止异常 当某个线程处于长时间的等待.休眠或其他暂停状态,而此时其他的线程通过Thread的interrupt方法终止该线程时抛出该异常 ...
- JAVA之Exchanger
如果两个线程在运行过程中需要交换彼此的信息,比如一个数据或者使用的空间,就需要用到Exchanger这个类,Exchanger为线程交换信息提供了非常方便的途径,它可以作为两个线程交换对象的同步点,只 ...
- poj1936---subsequence(判断子串)
#include<stdlib.h> #include<stdio.h> int main() { ],t[]; char *p1,*p2; while(scanf(" ...
- extend vg(pv,lv)use HotPlug Storage PV for VMI(ECC Env)
Preface: 前期存储未规划好,业务快速扩展,数据高安全需求(异地,More one copy),需求多多?NM干着干着活就会时不时的坑爹起来了!particularly Real Product ...
- sql server dateadd()
定义和用法 DATEADD() 函数在日期中添加或减去指定的时间间隔. 语法 DATEADD(datepart,number,date) date 参数是合法的日期表达式.number 是您希望添加的 ...
- [转]spring 监听器 IntrospectorCleanupListener简介
"在服务器运行过程中,Spring不停的运行的计划任务和OpenSessionInViewFilter,使得Tomcat反复加载对象而产生框架并用时可能产生的内存泄漏,则使用Introspe ...