思路:既然是求两个数的异或运算之和,且由于数字不重复,那么肯定两个数异或的结果数字越大越好,即异或后从ai二进制的最高位后全是1。具体思路看代码:AC代码: 1 #include 2 #include 3 #include 4 #include 5 #include 6 using nam...
分类:
其他好文 时间:
2014-09-15 12:54:28
阅读次数:
198
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5014题目大意:给定数组 a[]={0,1,2......n} 求一个数组b[] 元素也为0.....n 但顺序与a[]不同使得sum(ai ^ bi)最大注意到2^k =100000(k个0) 2^k-...
分类:
其他好文 时间:
2014-09-15 12:37:58
阅读次数:
179
LeetCode上面有这样两道Single Number 问题:
1、假设一个整型数组中所有的元素都出现了两次,唯独只有一个元素出现了一次,求出这个出现一次的元素。
2、假设一个整型数组中所有的元素都出现了三次,唯独只有一个元素出现了一次,求出这个出现一次的元素。
显然,两个问题唯一的不同就是大部分元素是出现了两次还是三次。
对于问题1:很好解决,通过异或运算,我们可以把所有出现两...
分类:
其他好文 时间:
2014-09-15 11:20:38
阅读次数:
112
【leetcode】Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input would have exactly one solution....
分类:
其他好文 时间:
2014-09-15 10:06:18
阅读次数:
192
版本控制比较普遍的 3 种命名格式 :一、GNU 风格的版本号命名格式 :主版本号 . 子版本号 [. 修正版本号 [. 编译版本号 ]]Major_Version_Number.Minor_Version_Number[.Revision_Number[.Build_Number]]示例 : 1....
分类:
其他好文 时间:
2014-09-15 09:56:28
阅读次数:
266
找规律
Number Sequence
Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 303 Accepted Submission(s): 149
Special Judge
Problem D...
分类:
其他好文 时间:
2014-09-15 01:09:18
阅读次数:
147
Problem Description
There are 2 special dices on the table. On each face of the dice, a distinct number was written. Consider a1.a2,a3,a4,a5,a6 to be numbers written on top face, bottom
face, left ...
分类:
其他好文 时间:
2014-09-15 01:08:48
阅读次数:
204
Problem Description
There is a special number sequence which has n+1 integers. For each number in sequence, we have two rules:
● ai ∈ [0,n]
● ai ≠ aj( i ≠ j )
For sequence a and sequence b,...
分类:
其他好文 时间:
2014-09-15 01:06:27
阅读次数:
175
HTML5 知识点(1)语义化标记 ,,,,,,,,,,(2)表单增强 ①新的INPUT类型: color, email, date, month, week, time, datetime, datetime-local, number, range, search, tel, url ②新属性:...
分类:
Web程序 时间:
2014-09-15 00:51:27
阅读次数:
303
HDU 5014 Number Sequence,二进制异或处理。...
分类:
其他好文 时间:
2014-09-14 23:46:17
阅读次数:
479