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 ...
随机推荐
- droppable的详细参数讲解
jQuery-Draggable参数介绍 默认设置值: $.extend($.ui.draggable, { version: “1.7.1″, eventPrefix: “drag”, de ...
- python日志记录-logging模块
1.logging模块日志级别 使用logging模块简单示例: >>>import logging >>>logging.debug("this's a ...
- 分享一个自用的 Inno Setup 软件打包脚本
此脚本支持打包mysql.安装mysql服务.安装windows服务.操作ini文件.操作注册表.高效压缩文件等功能,基本能满足常用的软件打包需求. ;定义各种常量 #define MyAppName ...
- 2.java.lang.NullPointerException(空指针异常)
调用了未经初始化的对象或者是不存在的对象 经常出现在创建图片,调用数组这些操作中,比如图片未经初始化,或者图片创建时的路径错误等等.对数组操作中出现空指针, 即把数组的初始化和数组元素的初始化混淆起来 ...
- 这才是正确删除 office 的方式
https://support.office.com/zh-cn/article/%E9%80%9A%E8%BF%87%E5%9C%A8%E9%87%8D%E6%96%B0%E5%AE%89%E8%A ...
- 2016 Multi-University Training Contest 1 总结
算是组队后第一次打比赛吧. 09题开始就有人过了,看到题目,这不是轮廓线DP的裸题么?!!,一发WA告终,然后发现题目是有改动的.还是太心急了. 然后我读了第一题,是最小生成树求期望距离,我把题意说了 ...
- ora-01031:insufficient privileges 解决方案
sqlplus /as sysdba 连补上,ora-01031的解决方法: (1)检查sqlnet.ora是否包含这句话:SQLNET.AUTHENTICATION_SERVICES=(NTS),没 ...
- UVA507-- Jill Rides Again
题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem& ...
- 最终有SpringMvc与Struts2的对照啦
眼下企业中使用SpringMvc的比例已经远远超过Struts2,那么两者究竟有什么差别,是非常多刚開始学习的人比較关注的问题,以下我们就来对SpringMvc和Struts2进行各方面的比較: 1. ...
- Java调用ICTCLAS2015
最近老板让做分词,指定使用ICTCLAS,于是到官网下载了2015,鼓捣了一晚上也没弄出来,百度了一上午还是一头雾水,,幸运的是现在已经弄好了,趁着没忘赶紧写下来. 1.首先解压并找到:2015080 ...