随笔分类 -  贪心

Min Number
摘要:Problem DescriptionNow you are given one non-negative integer n in 10-base notation, it will only contain digits ('0'-'9'). You are allowed to choose 2 integers i and j, such that: i!=j, 1≤i#include#includeusing namespace std;int p[1010];void swap(int &a,int &b){int temp=a;a= 阅读全文

posted @ 2013-09-26 17:34 forevermemory 阅读(222) 评论(0) 推荐(0)

Final Exam Arrangement
摘要:In Zhejiang University, there are N different courses labeled from 1 to N. Each course has its own time slot during the week. We can represent the time slot of a course by an left-closed right-open interval [s, t).Now we are going to arrange the final exam time of all the courses.The final exam peri 阅读全文

posted @ 2013-08-05 10:50 forevermemory 阅读(283) 评论(0) 推荐(0)

最少拦截系统
摘要:Problem Description某国为了防御敌国的导弹袭击,发展出一种导弹拦截系统.但是这种导弹拦截系统有一个缺陷:虽然它的第一发炮弹能够到达任意的高度,但是以后每一发炮弹都不能超过前一发的高度.某天,雷达捕捉到敌国的导弹来袭.由于该系统还在试用阶段,所以只有一套系统,因此有可能不能拦截所有的导弹. 怎么办呢?多搞几套系统呗!你说说倒蛮容易,成本呢?成本是个大问题啊.所以俺就到这里来求救了,请帮助计算一下最少需要多少套拦截系统.Input输入若干组数据.每组数据包括:导弹总个数(正整数),导弹依此飞来的高度(雷达给出的高度数据是不大于30000的正整数,用空格分隔)Output对应每组数 阅读全文

posted @ 2013-04-22 09:48 forevermemory 阅读(71) 评论(0) 推荐(0)

Super Jumping! Jumping! Jumping!
摘要:Problem DescriptionNowadays, a kind of chess game called “Super Jumping! Jumping! Jumping!” is very popular in HDU. Maybe you are a good boy, and know little about this game, so I introduce it to you now.The game can be played by two or more than two players. It consists of a chessboard(棋盘)and some 阅读全文

posted @ 2013-03-19 23:52 forevermemory 阅读(90) 评论(0) 推荐(0)

Tian Ji -- The Horse Racing
摘要:Tian Ji -- The Horse Racing Time Limit : 2000/1000ms (Java/Other)Memory Limit : 65536/32768K (Java/Other)Total Submission(s) : 4Accepted Submission(s) : 3Font: Times New Roman | Verdana | Georgia Font Size: ← →Problem DescriptionHere is a famous story in Chinese history."That was about 2300 yea 阅读全文

posted @ 2012-11-23 11:58 forevermemory 阅读(182) 评论(0) 推荐(0)

Crixalis's Equipment
摘要:Crixalis's Equipment Time Limit : 2000/1000ms (Java/Other)Memory Limit : 32768/32768K (Java/Other)Total Submission(s) : 5Accepted Submission(s) : 2Font: Times New Roman | Verdana | Georgia Font Size: ← →Problem DescriptionCrixalis - Sand King used to be a giant scorpion(蝎子) in the deserts of Kal 阅读全文

posted @ 2012-11-22 00:08 forevermemory 阅读(150) 评论(0) 推荐(0)

Saving HDU
摘要:Saving HDU Time Limit : 3000/1000ms (Java/Other)Memory Limit : 32768/32768K (Java/Other)Total Submission(s) : 3Accepted Submission(s) : 2Font: Times New Roman | Verdana | Georgia Font Size: ← →Problem Description话说上回讲到海东集团面临内外交困,公司的元老也只剩下XHD夫妇二人了。显然,作为多年拼搏的商人,XHD不会坐以待毙的。一天,当他正在苦思冥想解困良策的时候,突然想到了自己的传家 阅读全文

posted @ 2012-11-21 23:21 forevermemory 阅读(149) 评论(0) 推荐(0)

FatMouse' Trade
摘要:FatMouse' Trade Time Limit : 2000/1000ms (Java/Other)Memory Limit : 65536/32768K (Java/Other)Total Submission(s) : 5Accepted Submission(s) : 3Font: Times New Roman | Verdana | Georgia Font Size: ← →Problem DescriptionFatMouse prepared M pounds of cat food, ready to trade with the cats guarding t 阅读全文

posted @ 2012-11-21 22:42 forevermemory 阅读(100) 评论(0) 推荐(0)

删数问题
摘要:删数问题 Time Limit : 3000/1000ms (Java/Other)Memory Limit : 65535/32768K (Java/Other)Total Submission(s) : 4Accepted Submission(s) : 1Font: Times New Roman | Verdana | Georgia Font Size: ← →Problem Description键盘输入一个高精度的正整数n(≤240位),去掉其中任意s个数字后剩下的数字按原左右次序将组成一个新的正整数。编程对给定的n和s,寻找一种方案,使得剩下的数字组成的新数最小。 Input第 阅读全文

posted @ 2012-11-20 23:33 forevermemory 阅读(206) 评论(0) 推荐(0)

活动选择
摘要:活动选择 Time Limit : 3000/1000ms (Java/Other)Memory Limit : 65535/32768K (Java/Other)Total Submission(s) : 2Accepted Submission(s) : 2Font: Times New Roman | Verdana | Georgia Font Size: ← →Problem Description假设有一个需要使用某一资源的n个活动组成的集合S,S={1,……,n}。该资源一次只能被一个活动所占用,每一个活动有一个开始时间bi和结束时间ei (bi≤ei)。若bi≥ej或者bj≥e 阅读全文

posted @ 2012-11-20 22:34 forevermemory 阅读(190) 评论(0) 推荐(0)

积木分发
摘要:积木分发 Time Limit : 3000/1000ms (Java/Other)Memory Limit : 65535/32768K (Java/Other)Total Submission(s) : 4Accepted Submission(s) : 2Font: Times New Roman | Verdana | Georgia Font Size: ← →Problem Description歌手Pancakes到幼儿园跟小朋友玩,她到达的时候小朋友们正在争积木,小朋友都想要更多的积木砌一个自己喜欢的图形,砌完就可以和Pancakes合照。同时Pancakes手上还有一些积木, 阅读全文

posted @ 2012-11-20 22:21 forevermemory 阅读(299) 评论(0) 推荐(0)