Problem DescriptionMemphis loves xor very musch.Now he gets an array A.The length of A is n.Now he wants to know the sum of all (lowbit(Ai xor Aj) (i,...
分类:
编程语言 时间:
2015-06-13 22:53:56
阅读次数:
226
pog loves szh III
Accepts: 63
Submissions: 483
Time Limit: 12000/6000 MS (Java/Others)
Memory Limit: 131072/131072 K (Java/Others)
问题描述
pog在与szh玩游戏,首先pog在纸上画了一棵有根树,这里我们定义1...
分类:
其他好文 时间:
2015-06-13 11:26:44
阅读次数:
115
题意:给一个数字序列,要求再其中找到两个数,其和再模p的结果是最大的,求此和。思路:先将输入的元素模p,排序。结果可能有两种情况:(1)a+b大于p:肯定由两个最大的数之和来产生。(2)a+b小于p:设b为最大且a+b小于p,那么结果在这两个数的位置之间产生。用两个指针找出来,再与(1)中的ans比...
分类:
其他好文 时间:
2015-06-12 20:57:05
阅读次数:
162
枚举法:#include #include #include #include #include #include typedef long long ll;using namespace std;const int MAXN=100005;bool has[52];int f(int start)...
分类:
其他好文 时间:
2015-06-11 21:12:10
阅读次数:
157
You know — one loves the sunset, when one is so sad... 你知道的—当一个人情绪低落的时候,他会格外喜欢看日落...... If someone loves a flower, of which just one single blossom gr...
分类:
其他好文 时间:
2015-06-10 12:15:43
阅读次数:
106
题目链接:hdu 5265解题思路:对输入的数取模后进行排序后二分答案即可。没有注意到溢出问题,跪了三发。。。啥都不说了,代码自有分晓(nlogn)pog loves szh IITime Limit: 4000/2000 MS (Java/Others)Memory Limit: 65536/65...
分类:
其他好文 时间:
2015-06-10 00:57:29
阅读次数:
172
题目连接http://acm.hdu.edu.cn/showproblem.php?pid=5265pog loves szh IIDescriptionPog and Szh are playing games.There is a sequence with n numbers, Pog wil...
分类:
其他好文 时间:
2015-06-09 21:36:18
阅读次数:
104
DescriptionPog and Szh are playing games.There is a sequence with $n$ numbers, Pog will choose a number A from the sequence. Szh will choose an anothe...
分类:
编程语言 时间:
2015-06-09 19:46:19
阅读次数:
128
题意:给出一棵树,1为根节点,求一段区间内所有点的最近公共祖先。解法:用一棵线段树维护区间LCA。LCA是dp做法。dp[i][j]表示点i的第2^j个祖先是谁,转移方程为dp[i][j] = dp[dp[i][j - 1]][j - 1],初始的dp[i][0]可以用一次dfs求得,这样可以用lo...
分类:
其他好文 时间:
2015-06-09 15:40:44
阅读次数:
121