题目链接: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
找规律
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 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
HDU 5014 Number Sequence,二进制异或处理。...
分类:
其他好文 时间:
2014-09-14 23:46:17
阅读次数:
479
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, t...
分类:
其他好文 时间:
2014-09-14 23:41:28
阅读次数:
262
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5014解题报告:西安网赛的题,当时想到一半,只想到从大的开始匹配,做异或运算得到对应的b[i],但是少了一个操作,ans[i] = temp,却没有想到ans[temp] = i;所以就一直卡在这里了,因...
分类:
其他好文 时间:
2014-09-14 23:28:07
阅读次数:
219
HDU 5014 Number Sequence
题目链接
思路:对于0-n,尽量不让二进制中的1互相消掉就是最优的,那么只要两个数只要互补就可以了,这样每次从最大的数字,可以找到和他互补的数字,然后这个区间就能确定了,然后剩下的递归下去为一个子问题去解决
代码:
#include
#include
const int N = 100005;
int n, a[N]...
分类:
其他好文 时间:
2014-09-14 22:12:27
阅读次数:
220
HDU 5014 Number Sequence(异或 进制问题)...
分类:
其他好文 时间:
2014-09-14 22:10:27
阅读次数:
387
尽可能凑2^x-1
#include
#include
const int N = 100005;
int a[N], p[N];
int init(int x) {
int cnt = 0;
while(x > 1) {
x /= 2;
cnt ++;
}
return cnt + 1;
}
int main() {
int n;
while(~scanf("%d", ...
分类:
其他好文 时间:
2014-09-14 20:49:07
阅读次数:
165
图示 参考代码void shellSort(int A[], int lens){ if (A == NULL || lens 0; gap /= 2) { for (int i = gap; i = 0 && A[j] > A[j+gap]; j-=gap) ...
分类:
其他好文 时间:
2014-09-14 19:17:57
阅读次数:
221