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
Memory Limit:65536KTotal Submissions:4637Accepted:1180DescriptionGiven aN×Nmatrix A, whose element in thei-th row andj-th columnAijis an number that e...
分类:
其他好文 时间:
2014-09-14 20:43:07
阅读次数:
249
CREATE OR REPLACE FUNCTION TTD(V_DATE NUMBER) RETURN VARCHAR2 IS RESULT VARCHAR(100);BEGIN SELECT TO_CHAR(TO_DATE('1970-1-1 00:00:00', 'yyyy-mm-dd h.....
分类:
数据库 时间:
2014-09-14 20:38:37
阅读次数:
215
http://acm.hdu.edu.cn/showproblem.php?pid=5012Problem Description There are 2 special dices on the table. On each face of the dice, a distinct number ...
分类:
其他好文 时间:
2014-09-14 20:35:37
阅读次数:
269
要想正确的写出这个函数不是件容易的事情,因为要考虑的事情很多:
1)字符串的前后都可能会有空格,但是中间不允许有空格。
2)可能有小数,1.235,或者.3522这种形式
3)可能有指数形式,2e10 2e-1等形式
Validate if a given string is numeric.
Some examples:
"0" => true
" 0.1 " => t...
分类:
其他好文 时间:
2014-09-14 16:45:37
阅读次数:
201
题目:
The gray code is a binary numeral system where two successive values differ in only one bit.
Given a non-negative integer n representing the total number of bits in the code, print the...
分类:
其他好文 时间:
2014-09-14 11:22:47
阅读次数:
181