【题目链接】 http://poj.org/problem?id=2886 【题目大意】 一些人站成一个圈,每个人手上都有一个数字, 指定从一个人开始淘汰,每次一个人淘汰时,将手心里写着的数字x展示 如果x是正数,则淘汰右手边第x个人,否则淘汰左手边地-x个人。 每个人淘汰的时候将获得积分,积分的多 ...
分类:
其他好文 时间:
2017-01-21 16:00:56
阅读次数:
206
135. Candy 135. Candy There are N children standing in a line. Each child is assigned a rating value. You are giving candies to these children subject ...
分类:
编程语言 时间:
2017-01-03 20:31:53
阅读次数:
276
对于每个物品,如果购买,价值为A[i]*x+B[i]的背包问题。 先写了一发是WA的= =。代码如下: 正解是,先跑一遍价值为A[i]+B[i]的01背包,再跑一遍价值为A[i]完全背包。所以上面的代码错了大概是因为,这两个背包的第二个for的方向是不同的,没办法一起跑吧(除非用另外一组变量记录下到 ...
分类:
其他好文 时间:
2016-12-16 21:58:02
阅读次数:
171
There are N children standing in a line. Each child is assigned a rating value. You are giving candies to these children subjected to the following re ...
分类:
编程语言 时间:
2016-11-14 17:43:28
阅读次数:
231
A Simple Nim Problem Description Two players take turns picking candies from n heaps,the player who picks the last one will win the game.On each turn ...
分类:
其他好文 时间:
2016-10-29 19:35:39
阅读次数:
312
There are N children standing in a line. Each child is assigned a rating value. You are giving candies to these children subjected to the following re ...
分类:
其他好文 时间:
2016-10-14 07:35:00
阅读次数:
111
题解: 记忆化搜索 如何判断一个数是否已经出现?应用位运算即可.... 代码: ...
分类:
其他好文 时间:
2016-10-11 21:48:52
阅读次数:
119
poj3159 Candies 这题实质为裸的差分约束。 先看最短路模型:若d[v] >= d[u] + w, 则连边u->v,之后就变成了d[v] <= d[u] + w , 即d[v] – d[u] <= w。 再看题目给出的关系:b比a多的糖果数目不超过c个,即d[b] – d[a] <= c ...
分类:
其他好文 时间:
2016-09-14 21:53:59
阅读次数:
120
题目链接 http://acm.split.hdu.edu.cn/showproblem.php?pid=5410 Problem Description Today is CRB's birthday. His mom decided to buy many presents for her lo ...
分类:
其他好文 时间:
2016-09-02 21:57:51
阅读次数:
193
There are N children standing in a line. Each child is assigned a rating value. You are giving candies to these children subjected to the following re ...
分类:
其他好文 时间:
2016-09-01 20:07:03
阅读次数:
157