第二个样例是3 3 1 2 4 1 3 5 2 3 6题解:http://blog.csdn.net/thy_asdf/article/details/47355475code: 1 #include 2 #include 3 #include 4 #include 5 #include 6 #de...
分类:
其他好文 时间:
2015-08-12 18:49:20
阅读次数:
90
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5375编码规则:tmp = XOR(gr[i],gr[i-1]);算是找规律的题目吧,考虑?前后字符和?数目的奇偶性就可以了,一个小trick就是当碰到需要减的时候是减问号区间内最小的那个,然后就是调试的...
分类:
其他好文 时间:
2015-08-12 13:02:40
阅读次数:
87
题意:n个点给出m个关系(AND,OR,XOR),问是否存在解。
思路:2-SAT建图
a AND b = 1: ~x->x,~y->y (两个数必须全为1)
a AND b = 0: y->~x,x->~y (两个数至少有一个为0)
a OR b = 1:~x->y,~y->x (两个数至少有一个为1)
a OR b = 0: x->~x,y->~y (两个数必须全为0)
a XOR b = 1:x->~y,y->~x,~y->x,~x->y (两个数必须不同)
a XOR b = 0:x->y,y->x...
分类:
其他好文 时间:
2015-08-10 16:15:28
阅读次数:
100
题意:输入整数(1=
解题思路:
看到题目之后一直在找最大公约数和异或之间的关系,但找了半天没有发现。于是果断打表发现如下规律
满足gcd(a,b)=a^b的数有如下规律,要么就是a=b-1,要么就是有前面已求得的满足条件的乘上一定的倍数得到如下:
根据上述规律,我们便可以求的所有的可能性,上面只打印了一部分,整个程序2秒左右完成预处理
代码:
#include...
分类:
其他好文 时间:
2015-08-09 20:45:40
阅读次数:
136
题意:给你一组数,开始询问给一个数 求组中与该数异或值最大的数。分析:根据异或的特点 要想得到的异或值最大 尽可能的让两个数的每位都相反 先把给定的一组数建树,数的最后一位对应的节点保存这个数的位置(放便取) 对于每个询问 在搜树时优先考虑和当前数位相反的节点。#include #include #...
分类:
其他好文 时间:
2015-08-09 17:03:42
阅读次数:
97
叶节点SG值至0 非叶节点SG值至于它的所有子节点SG值添加1 XOR和后#include #include #include using namespace std;vector G[100010];int sg[100010];int dfs(int x, int f){ if(sg[x] !....
分类:
其他好文 时间:
2015-08-08 14:55:39
阅读次数:
122
MZL's xor
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 546 Accepted Submission(s): 365
Problem Description
MZL loves xor very muc...
分类:
其他好文 时间:
2015-08-06 11:07:51
阅读次数:
102
here:
首先看一下题吧:题意就是让你把一个序列里所有的(Ai+Aj) 的异或求出来。(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 (Ai+Aj)(1≤i,j≤n)
...
分类:
其他好文 时间:
2015-08-06 09:31:18
阅读次数:
215
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 (Ai+Aj)(1≤i,j≤n)The xor of an array B is defined a...
分类:
其他好文 时间:
2015-08-06 00:00:57
阅读次数:
510
转载请注明出处:http://www.cnblogs.com/fraud/ ——by fraudMZL's xorTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/65536 K (Java/Others)Total Submissi...
分类:
其他好文 时间:
2015-08-05 21:41:16
阅读次数:
117