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 ...
随机推荐
- PagerAdapter instantiateItem()方法position错误解决方案
异常信息:java.lang.IndexOutOfBoundsException: index=3 count=2 在instantiateItem各个条目View的时候.会有 container.a ...
- 记一次C++与lua连接
今晚,花了两个多钟折腾lua和c++的互连,终于成功了,觉得有必要记录下来.说实话,搜索引擎真是有利有弊,利在你有地方搜答案,弊则在于你半天都找不到正确的答案甚至找到误导你的答案,今晚更加加深了我的体 ...
- selenium webdriver 学习笔记(一)
selenium webdriver 第一个脚本: #coding = utf-8 from selenium import webdriver import time url = "htt ...
- Linux中的网络
在windows 中表示一张网卡用本地连接1,本地连接2这种方式来表示:而在linux 中用的是etho,eth1 等等这样的东西来表示的.
- 15.java.lang.InstantiationException
java.lang.InstantiationException 实例化异常 当试图通过Class的newInstance()方法创建某个类的实例,但程序无法通过该构造器来创建该对象时引发 Class ...
- Linux下面如何运行.sh文件
Linux下面如何运行.sh文件 本文介绍Linux下面用命令如何运行.sh文件的方法,有两种方法: 一.直接./加上文件名.sh,如运行hello.sh为./hello.sh[hello.sh必 ...
- NOI2011 Day1
NOI2011 Day1 兔农 题目描述:\(fib[1]=fib[2]=1, fib[i]=fib[i-2]+fib[i-1] (i\geq 3)\),若\(fib[i] \equiv 1(mod ...
- cors技术
简称跨域资源共享: 若是配置nodejs: 需在公共路由添加三句话:代码如下: // 全局头设置 app.all('*', function(req, res, next) { res.set({ ' ...
- codechef Chef and The Right Triangles 题解
Chef and The Right Triangles The Chef is given a list of N triangles. Each triangle is identfied by ...
- 达内TTS6.0课件oop_day05