uva 307 Sticks
George took sticks of the same length and cut them randomly until all parts became at most 50 units long. Now he wants to return sticks to the original state, but he forgot how m...
分类:
其他好文 时间:
2015-02-04 16:47:33
阅读次数:
187
这题就是贪心算法,先对length升序排列,如果length相等,再按weight升序排列;反之亦可。然后根据题目要求进行选择即可。
不过我在写排序函数的时候出了一点问题,害得我还一度以为我的贪心策略是错的。
#include
#include
#include
#include
#include
#include
using namespace std;
const int N=5005;
...
分类:
其他好文 时间:
2015-02-02 21:31:16
阅读次数:
124
/**POJ 2513 Colored Sticks*参考: http://poj.org/showmessage?message_id=181500*Hash + 并查集 + 欧拉通路判定*把每根棍子看成一条无向边*Hash函数来自上面的链接,数据弱所以table 1000 就够了*/#inclu...
分类:
其他好文 时间:
2015-02-02 12:10:32
阅读次数:
154
题目: Wooden SticksTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 2374 Accepted Submission(s): 921 Problem DescriptionThere is a pile of n woo...
分类:
其他好文 时间:
2015-01-29 21:11:15
阅读次数:
264
转自http://m.blog.csdn.net/blog/wuxinliulei/9052707Sticks 这一题仍然要采用深度优先搜索+剪枝 这一题的剪枝很重要。 首先题意是要求木棒的最短长度,首先明确一点木棒的长度一定在最长木棒长度---所有木棒长度总和之间 所以在读入木棒长度之后要找出最长...
分类:
其他好文 时间:
2015-01-29 14:09:56
阅读次数:
124
题目链接:
找规律的一道题,row往前进2步的话,如果投影在zigzag的路径上,则是走了一个V字形,也就是说每一行的相邻2步,都是走了同样的投影距离。然后主要抓到步数计算的规律即可。
*注意step为0的情况,这时候要pick up最大的步长继续走。
*注意row为1行的情况,最早判断,避免死循环,因为步长是0。
*一直尝试po讲解照片,但是无论如何都显示不出来。有空搞定了传张照...
分类:
其他好文 时间:
2015-01-07 18:55:23
阅读次数:
133
http://codeforces.com/problemset/problem/18/D
Last year Bob earned by selling memory sticks. During each of n days of his work one of the two following events took place:
A customer came t...
分类:
其他好文 时间:
2015-01-04 19:21:42
阅读次数:
217
http://poj.org/problem?id=2653我很好奇为什么这样$O(n^2)$的暴力能过....虽然说这是加了链表优化的,但是最坏不也是$O(n^2)$吗。。。(只能说数据太弱...)然后本题裸的判线段相交和点在直线上...(看了网上的标程,不判端点的情况都能过我也是醉了...)#i...
分类:
其他好文 时间:
2015-01-01 17:18:03
阅读次数:
130
题目链接 :http://acm.hdu.edu.cn/showproblem.php?pid=1518SquareProblem DescriptionGiven a set of sticks of various lengths, is it possible to join them end...
分类:
其他好文 时间:
2014-12-19 15:44:33
阅读次数:
185
题目:EOJ1981 || POJ1011 经典dfs+剪枝+奇怪的数据
Description
George took sticks of the same length and cut them randomly until all partsbecame at most 50 units long. Now he wants to return sticks to th...
分类:
其他好文 时间:
2014-12-18 20:44:15
阅读次数:
242