题目链接:hdu 4825 Xor Sum
题目大意:中文题。
解题思路:将给定得数按照二进制建成一颗字典树,每一层分别对应的各个位数上的01状态。然后每一次查询,如果对应位置为0,则要往1的方向走,如果是1,则要往0的方向走。但是要注意,走的前提是对应分支是存在的。
#include
#include
#include
using namespace std;
//type...
分类:
其他好文 时间:
2014-05-23 02:15:15
阅读次数:
286
What Is Your Grade?
Problem Description
“Point, point, life of student!”
This is a ballad(歌谣)well known in colleges, and you must care about your...
分类:
其他好文 时间:
2014-05-23 00:59:22
阅读次数:
375
题目链接:hdu 4824 Disk Schedule
题目大意:中文题。
解题思路:需要的时,很明显每到一层是要读取一次数据的,但是因为需要返回00,所以有些层的数据可以在返回的过程中读取会较优。于是转化成了双调欧几里得旅行商问题。
#include
#include
#include
#include
using namespace std;
const int N =...
分类:
其他好文 时间:
2014-05-23 00:00:02
阅读次数:
382
题目:
链接:点击打开链接
题意:
想看n个电影,只能从中选m个,用l时间来看,这n个电影都要花费时间a[i]去看,也有一定的价值b[i],选取最大的价值。
思路:
这是二维费用背包,总时间l是背包容量,选m个是隐藏的花费,每个电影需要的时间a[i]也是花费。这样,状态转移方程就有了:dp[i][j] = max( dp[i][j] , dp[i-1][j-a[i...
分类:
其他好文 时间:
2014-05-22 23:25:03
阅读次数:
335
题目链接:hdu 4826 Labyrinth
题目大意:中文题。
解题思路:不难想的递推,dp[i][j][0]从上面过来的情况,dp[i][j][1]从下面过来的情况,然后这两种情况都可以从前一列走过来。
#include
#include
#include
using namespace std;
const int N = 105;
const int INF = 0...
分类:
其他好文 时间:
2014-05-22 22:42:28
阅读次数:
350
题目链接:hdu 4823 Energy Conversion
题目大意:中文题,不解释。
解题思路:首先判断一下m是否已经大于n了,如果大于那么就是0,假设中间变换的各个值为ai,那么bi=ai+c,bi数组为等比数组(可推),所以就有了cnt=log((n+c)a)log(double(k)),结果为浮点数,需要向上取整。
#include
#include
#include...
分类:
其他好文 时间:
2014-05-22 22:34:41
阅读次数:
308
题目:http://acm.hdu.edu.cn/showproblem.php?pid=1228
1、 没读清题就交-----a==0 && b==0 我以为zero zero借书
2、范围估计,100+100。。。。
3、代码设计,,,,
#include
#include
using namespace std;
#define SIZE 111
#define ll long...
分类:
其他好文 时间:
2014-05-22 18:46:45
阅读次数:
513
题目:http://poj.org/problem?id=1226
http://acm.hdu.edu.cn/showproblem.php?pid=1238
其实用hash+lcp可能也可以,甚至可能写起来更快,不过我没试,我最近在练习后缀数组,所以来练手
后缀数组的典型用法之一----------------后缀数组+lcp+二分
思路:1、首先将所有的字符串每读...
分类:
其他好文 时间:
2014-05-22 17:14:08
阅读次数:
289
【题目】
Given an array of non-negative integers, you are initially positioned at the first index of the array.
Each element in the array represents your maximum jump length at that position.
Your goal is to reach the last index in the minimum number of ju...
分类:
其他好文 时间:
2014-05-22 17:02:20
阅读次数:
244
Max Sum Plus PlusTime Limit: 2000/1000 MS
(Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s):
15817Accepted Submission(s): 5140...
分类:
其他好文 时间:
2014-05-22 14:06:42
阅读次数:
250