贪心
ljtlyy
这个作者很懒,什么都没留下…
展开
-
acm 贪心总结
⑴ 有一个以最优方式来解决的问题。为了构造问题的解决方案,有一个候选的对象的集合:比如不同面值的硬币。⑵ 随着算法的进行,将积累起其它两个集合:一个包含已经被考虑过并被选出的候选对象,另一个包含已经被考虑过但被丢弃的候选对象。⑶ 有一个函数来检查一个候选对象的集合是否提供了问题的解答。该函数不考虑此时的解决方法是否最优。⑷ 还有一个函数检查是否一个候选对象的集合是可行的,也原创 2016-03-31 20:35:08 · 635 阅读 · 0 评论 -
acm 1000 Moving Tables(贪心算法)
1.10002.沿着走廊的北面和南面分别有200个房间(共计400间),公司搬桌子,从一个房间到另一个房间在10分钟内,当搬动一张桌子从房间i到房间J,房间i和房间j前面的部分走廊就被占用了.因此,在每个10分钟内,两个房间之间的搬动就不会同时用到走廊相同的部分.每个房间,只有一张桌子可以搬进或搬出.输入格式 第一行例子数,第二行需搬桌子的个数,第二行从房间i到房间j,每个示例格式相同原创 2016-03-14 17:04:14 · 633 阅读 · 0 评论 -
acm 1001 木桩放置
1.10012.Problem DescriptionThere is a pile of n wooden sticks. The length and weight of each stick are known in advance. The sticks are to be processed by a woodworking machine in one by one fashi原创 2016-03-21 17:34:46 · 276 阅读 · 0 评论 -
acm 1006 电梯移动时间问题
1.10062.Problem DescriptionThe highest building in our city has only one elevator. A request list is made up with N positive numbers. The numbers denote at which floors the elevator will stop, in原创 2016-03-21 18:06:25 · 445 阅读 · 0 评论 -
acm 1016 牛奶中位数
1.10162.Problem DescriptionFJ is surveying his herd to find the most average cow. He wants to know how much milk this 'median' cow gives: half of the cows give as much or more than the median; h原创 2016-03-21 18:18:13 · 479 阅读 · 0 评论 -
acm 1008同1001木桩题
1.1008/10012.Problem DescriptionThere is a pile of n wooden sticks. The length and weight of each stick are known in advance. The sticks are to be processed by a woodworking machine in one by one原创 2016-03-21 18:36:40 · 288 阅读 · 0 评论 -
acm 1002 田忌赛马
1.10022.Problem DescriptionHere is a famous story in Chinese history."That was about 2300 years ago. General Tian Ji was a high official in the country Qi. He likes to play horse racing with t原创 2016-03-27 18:09:30 · 312 阅读 · 0 评论 -
acm 1003 哈夫曼
1.10032.Problem DescriptionAn entropy encoder is a data encoding method that achieves lossless data compression by encoding a message with “wasted” or “extra” information removed. In other words原创 2016-03-27 18:31:40 · 303 阅读 · 0 评论 -
acm 1009哈夫曼编码(同1003)
1.10032.Problem DescriptionAn entropy encoder is a data encoding method that achieves lossless data compression by encoding a message with “wasted” or “extra” information removed. In other words原创 2016-03-27 18:40:34 · 565 阅读 · 0 评论 -
acm 1010颜料问题
1.10102.Problem DescriptionThe local toy store sells small fingerpainting kits with between three and twelve 50ml bottles of paint, each a different color. The paints are bright and fun to work wi原创 2016-03-27 18:46:47 · 326 阅读 · 0 评论 -
acm 1012 大数问题
1.10122.Problem DescriptionCurrent work in cryptography involves (among other things) large prime numbers and computing powers of numbers among these primes. Work in this area has resulted in th原创 2016-03-27 18:58:07 · 234 阅读 · 0 评论 -
acm 1013 公司盈利
1.10132.Problem DescriptionAccounting for Computer Machinists (ACM) has sufferred from the Y2K bug and lost some vital data for preparing annual report for MS Inc.All what they remember is t原创 2016-03-27 19:10:48 · 439 阅读 · 0 评论 -
acm 1005 纸币问题
1.10052.Problem Description"Yakexi, this is the best age!" Dong MW works hard and get high pay, he has many 1 Jiao and 5 Jiao banknotes(纸币), some day he went to a bank and changes part of his mo原创 2016-03-29 17:53:53 · 452 阅读 · 0 评论 -
acm 1015 最佳生产方式
1.10152.Problem DescriptionThe cows have purchased a yogurt factory that makes world-famous Yucky Yogurt. Over the next N (1 <= N <= 10,000) weeks, the price of milk and labor will fluctuate wee原创 2016-03-29 18:06:19 · 274 阅读 · 0 评论 -
acm 1017 装箱问题
1.10142.Problem DescriptionA factory produces products packed in square packets of the same height h and of the sizes 1*1, 2*2, 3*3, 4*4, 5*5, 6*6. These products are always delivered to custo原创 2016-03-31 19:42:17 · 378 阅读 · 0 评论 -
acm 1007 接力问题
1.10072.Problem DescriptionA relay is a race for two or more teams of runners. Each member of a team runs one section of the race. Your task is to help to evaluate the results of a relay race.原创 2016-03-31 19:52:40 · 283 阅读 · 0 评论 -
acm 1011 雷达数目
1.10112.Problem DescriptionAssume the coasting is an infinite straight line. Land is in one side of coasting, sea in the other. Each small island is a point locating in the sea side. And any rad原创 2016-03-31 20:01:32 · 331 阅读 · 0 评论 -
acm 1014 满载问题
1.10142.Problem DescriptionBefore bridges were common, ferries were used to transport cars across rivers. River ferries, unlike their larger cousins, run on a guide line and are powered by the r原创 2016-03-31 20:25:49 · 318 阅读 · 0 评论