MZL's xor

Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 65536/65536K (Java/Other)
Total Submission(s) : 1   Accepted Submission(s) : 1
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 ($A_i$+$A_j$)($1\leq i,j \leq n$)
The xor of an array B is defined as $B_1$ xor $B_2$...xor $B_n$
 
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$ $A_1=0$,$A_i=(A_{i-1}*m+z)$ $mod$ $l$ $1\leq m,z,l \leq 5*10^5$,$n=5*10^5$
 
Output
For every test.print the answer.
 
Sample Input
2 3 5 5 7 6 8 8 9
 
Sample Output
14 16
 题解:就是A数组可以得出,B数组是A[i]+A[j]组成的数组让求B1^B2^.......^Bn的值;
代码:
 #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的更多相关文章

  1. hdu5344 MZL's xor(水题)

    转载请注明出处: http://www.cnblogs.com/fraud/          ——by fraud MZL's xor Time Limit: 2000/1000 MS (Java/ ...

  2. 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 ...

  3. hdu 5344 MZL's xor

    MZL's xor Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total S ...

  4. 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 ...

  5. HDU 5344 MZL's xor (水题)

    题意:给一个序列A,设序列B的中的元素有(Ai+Aj)(1≤i,j≤n),那么求B中所有元素的异或之和.而序列A是这样来的:A1=0,Ai=(Ai−1∗m+z) mod l. 思路:相同的元素异或结果 ...

  6. hdoj 5344 MZL's xor

    题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=5344 #include<stdio.h> #include<cstring> ...

  7. HDU 5344(MZL&#39;s xor-(ai+aj)的异或和)

    MZL's xor Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total ...

  8. 2015 多校联赛 ——HDU5344(水)

    Problem Description MZL loves xor very much.Now he gets an array A.The length of A is n.He wants to ...

  9. [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 ...

随机推荐

  1. droppable的详细参数讲解

    jQuery-Draggable参数介绍     默认设置值: $.extend($.ui.draggable, { version: “1.7.1″, eventPrefix: “drag”, de ...

  2. python日志记录-logging模块

    1.logging模块日志级别 使用logging模块简单示例: >>>import logging >>>logging.debug("this's a ...

  3. 分享一个自用的 Inno Setup 软件打包脚本

    此脚本支持打包mysql.安装mysql服务.安装windows服务.操作ini文件.操作注册表.高效压缩文件等功能,基本能满足常用的软件打包需求. ;定义各种常量 #define MyAppName ...

  4. 2.java.lang.NullPointerException(空指针异常)

    调用了未经初始化的对象或者是不存在的对象 经常出现在创建图片,调用数组这些操作中,比如图片未经初始化,或者图片创建时的路径错误等等.对数组操作中出现空指针, 即把数组的初始化和数组元素的初始化混淆起来 ...

  5. 这才是正确删除 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 ...

  6. 2016 Multi-University Training Contest 1 总结

    算是组队后第一次打比赛吧. 09题开始就有人过了,看到题目,这不是轮廓线DP的裸题么?!!,一发WA告终,然后发现题目是有改动的.还是太心急了. 然后我读了第一题,是最小生成树求期望距离,我把题意说了 ...

  7. ora-01031:insufficient privileges 解决方案

    sqlplus /as sysdba 连补上,ora-01031的解决方法: (1)检查sqlnet.ora是否包含这句话:SQLNET.AUTHENTICATION_SERVICES=(NTS),没 ...

  8. UVA507-- Jill Rides Again

    题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem& ...

  9. 最终有SpringMvc与Struts2的对照啦

    眼下企业中使用SpringMvc的比例已经远远超过Struts2,那么两者究竟有什么差别,是非常多刚開始学习的人比較关注的问题,以下我们就来对SpringMvc和Struts2进行各方面的比較: 1. ...

  10. Java调用ICTCLAS2015

    最近老板让做分词,指定使用ICTCLAS,于是到官网下载了2015,鼓捣了一晚上也没弄出来,百度了一上午还是一头雾水,,幸运的是现在已经弄好了,趁着没忘赶紧写下来. 1.首先解压并找到:2015080 ...