题目:http://acm.hdu.edu.cn/showproblem.php?pid=5543 题意:给你一块长为L的木板,和n个金条,每个金条有一个长度和价值 只要金条的重心在木板上就可以放上去,但不能重叠,问最多能拿多大价值 很容易想到背包问题,但是题目给出了一定限制 因为最多有2根金条是半 ...
分类:
其他好文 时间:
2017-09-20 14:22:57
阅读次数:
145
We are playing the Guess Game. The game is as follows: I pick a number from 1 to n. You have to guess which number I picked. Every time you guess wron ...
分类:
其他好文 时间:
2017-09-10 23:42:58
阅读次数:
235
N pots, each with some number of gold coins, are arranged in a line. You are playing a game against another player. You take turns picking a pot of go ...
分类:
其他好文 时间:
2017-08-28 23:49:27
阅读次数:
239
Three types of answer: Map Solution, O(N) memory, O(N) init, O(1) pick. Like @dettier's Reservoir Sampling. O(1) init, O(1) memory, but O(N) to pick. ...
分类:
其他好文 时间:
2017-08-19 23:40:55
阅读次数:
239
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5543 题意: 给你N个金条和一张长度为L的桌子。每个金条长度为a[i],价值为w[i]。金条只能在桌子上横着摆一排,并且只要金条的重心(中心)在桌子上,就可以放。问你在桌子上能够摆的金条的最大总价值。 ...
分类:
其他好文 时间:
2017-08-15 10:05:40
阅读次数:
164
考察题意的理解和转化, 找到knows(候选人, i) 来传递候选人, 候选人谁也不知道. 最后确定是否是候选人, 因为前面的可能有人不知道他, 那么他就不是候选人 最佳做法:O(N)time, O(1)space The first pass is to pick out the candidat ...
分类:
其他好文 时间:
2017-08-14 14:27:00
阅读次数:
149
最近稍微有点懈怠了 刷题不勤了 勉励下自己 这道题目挺有意思的 We are playing the Guess Game. The game is as follows:I pick a number from 1 to n. You have to guess which number I pi ...
分类:
其他好文 时间:
2017-08-14 00:34:55
阅读次数:
168
We are playing the Guess Game. The game is as follows: I pick a number from 1 to n. You have to guess which number I picked. Every time you guess wron... ...
分类:
其他好文 时间:
2017-08-08 20:02:14
阅读次数:
182
Description Description Stan has n sticks of various length. He throws them one at a time on the floor in a random way. After finishing throwing, Stan ...
分类:
其他好文 时间:
2017-08-03 11:21:16
阅读次数:
176
1、In a bar Do you come here often? I've never seen you here before. What do you think of this bar? Are you drinking___?I love that drink! Great___!(co ...
分类:
其他好文 时间:
2017-07-31 10:07:13
阅读次数:
203