随笔分类 -  贪心

摘要:DescriptionLindsay is a shopaholic. Whenever there is a discount of the kind where you can buy three items and only pay for two, she goes completely mad and feels a need to buy all items in the store. You have given up on curing her for this disease, but try to limit its effect on her wallet.You hav 阅读全文
posted @ 2014-02-25 17:10 AHU_树 阅读(434) 评论(0) 推荐(0)
摘要:DescriptionFarmer John has a problem: the dirt road from his farm to town has suffered in the recent rainstorms and now contains (1 #include #include #include #include #include #include using namespace std;typedef struct { int s, e;}node;node a[10000+10];bool cmp(node a, node b){ return a.s = ... 阅读全文
posted @ 2014-02-23 11:00 AHU_树 阅读(664) 评论(0) 推荐(0)
摘要: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 radar installation, locating on the coasting, can only cover d distance, so an island in the sea can be covered by a radius i 阅读全文
posted @ 2014-02-22 17:29 AHU_树 阅读(283) 评论(0) 推荐(0)
摘要:DescriptionA supermarket has a set Prod of products on sale. It earns a profit px for each product x∈Prod sold by a deadline dx that is measured as an integral number of time units starting from the moment the sale begins. Each product takes precisely one unit of time for being sold. A selling sched 阅读全文
posted @ 2014-02-22 16:08 AHU_树 阅读(285) 评论(0) 推荐(0)
摘要:Problem DescriptionIgnatius has just come back school from the 30th ACM/ICPC. Now he has a lot of homework to do. Every teacher gives him a deadline of handing in the homework. If Ignatius hands in the homework after the deadline, the teacher will reduce his score of the final test. And now we assum 阅读全文
posted @ 2014-02-22 14:34 AHU_树 阅读(465) 评论(0) 推荐(0)
摘要:DescriptionMany graduate students of Peking University are living in Wanliu Campus, which is 4.5 kilometers from the main campus – Yanyuan. Students in Wanliu have to either take a bus or ride a bike to go to school. Due to the bad traffic in Beijing, many students choose to ride a bike.We may assum 阅读全文
posted @ 2014-02-22 13:37 AHU_树 阅读(1158) 评论(0) 推荐(0)
摘要:DescriptionWe have received an order from Pizoor Communications Inc. for a special communication system. The system consists of several devices. For each device, we are free to choose from several manufacturers. Same devices from two manufacturers differ in their maximum bandwidths and prices.By ove 阅读全文
posted @ 2014-02-21 21:22 AHU_树 阅读(450) 评论(0) 推荐(0)
摘要:Problem DescriptionSuppose there are M people, including you, playing a special card game. At the beginning, each player receives N cards. The pip of a card is a positive integer which is at most N*M. And there are no two cards with the same pip. During a round, each player chooses one card to compa 阅读全文
posted @ 2014-02-20 22:42 AHU_树 阅读(319) 评论(0) 推荐(0)
摘要: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 fashion. It needs some time, called setup time, for the machine to prepare processing a stick. The setup times are as 阅读全文
posted @ 2014-02-19 17:19 AHU_树 阅读(303) 评论(0) 推荐(0)
摘要:DescriptionFarmer John has received a noise complaint from his neighbor, Farmer Bob, stating that his cows are making too much noise.FJ's N cows (1 #include #include using namespace std; int a[10000+10]; int main() { int n; scanf("%d", &n); for(int i = 0 ; i #include using namespac 阅读全文
posted @ 2014-02-19 15:42 AHU_树 阅读(234) 评论(0) 推荐(0)
摘要: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 customers in the square parcels of the same height h as the products have and of the size 6*6. Because of the expenses it is the 阅读全文
posted @ 2014-02-17 22:29 AHU_树 阅读(448) 评论(0) 推荐(0)
摘要:Problem DescriptionThe famous ACM (Advanced Computer Maker) Company has rented a floor of a building whose shape is in the following figure. The floor has 200 rooms each on the north side and south side along the corridor. Recently the Company made a plan to reform its system. The reform includes mo 阅读全文
posted @ 2014-02-16 21:54 AHU_树 阅读(566) 评论(0) 推荐(0)
摘要:Problem DescriptionFatMouse prepared M pounds of cat food, ready to trade with the cats guarding the warehouse containing his favorite food, JavaBean.The warehouse has N rooms. The i-th room contains J[i] pounds of JavaBeans and requires F[i] pounds of cat food. FatMouse does not have to trade for a 阅读全文
posted @ 2014-02-16 20:34 AHU_树 阅读(633) 评论(0) 推荐(0)
摘要:Description临近开学了,大家都忙着收拾行李准备返校,但I_Love_C却不为此担心! 因为他的心思全在暑假作业上:目前为止还未开动(-_-!!还以为他有多冷静呢)。暑假作业是很多张试卷,我们这些从试卷里爬出来的人都知道,卷子上的题目有选择题、填空题、简答题、证明题等。 而做选择题的好处就在于工作量很少,但又因为选择题题目都普遍很长。 如果有5张试卷,其中4张是选择题,最后一张是填空题,很明显做最后一张所花的时间要比前4张长很多。 但如果你只做了选择题,虽然工作量很少,但表面上看起来也已经做了4/5的作业了。 I_Love_C决定就用这样的方法来蒙混过关。他统计出了做完每一张试卷所需的 阅读全文
posted @ 2013-12-24 16:35 AHU_树 阅读(588) 评论(0) 推荐(0)
摘要:Description赛马是一古老的游戏,早在公元前四世纪的中国,处在诸侯割据的状态,历史上称为“战国时期”。在魏国作官的孙膑,因为受到同僚庞涓的迫害,被齐国使臣救出后,到达齐国国都。 赛马是当时最受齐国贵族欢迎的娱乐项目。上至国王,下到大臣,常常以赛马取乐,并以重金赌输赢。田忌多次与国王及其他大臣赌输赢,屡赌屡输。一天他赛马又输了,回家后闷闷不乐。孙膑安慰他说:“下次有机会带我到马场看看,也许我能帮你。” 孙膑仔细观察后发现,田忌的马和其他人的马相差并不远,只是策略运用不当,以致失败。 比赛前田忌按照孙膑的主意,用上等马鞍将下等马装饰起来,冒充上等马,与齐王的上等马比赛。第二场比赛,还是按照 阅读全文
posted @ 2013-12-11 21:30 AHU_树 阅读(375) 评论(0) 推荐(0)