随笔分类 -  贪心

摘要:Farmer John wants to repair a small length of the fence around the pasture. He measures the fence and finds that he needs N (1 ≤ N ≤ 20,000) planks of 阅读全文
posted @ 2018-04-11 16:32 左手边五十米 阅读(245) 评论(0) 推荐(0)
摘要:Description Oh those picky N (1 <= N <= 50,000) cows! They are so picky that each one will only be milked over some precise time interval A..B (1 <= A 阅读全文
posted @ 2018-04-07 20:13 左手边五十米 阅读(193) 评论(0) 推荐(0)
摘要:Description 三个农民每天清晨5点起床,然后去牛棚给3头牛挤奶。第一个农民在300时刻(从5点开始计时,秒为单位)给他的牛挤奶,一直到1000时刻。第二个农民在700时刻开始,在 1200时刻结束。第三个农民在1500时刻开始2100时刻结束。期间最长的至少有一个农民在挤奶的连续时间为90 阅读全文
posted @ 2018-04-01 15:46 左手边五十米 阅读(271) 评论(0) 推荐(2)
摘要:Description 排序是一种很频繁的计算任务。现在考虑最多只有三值的排序问题。一个实际的例子是,当我们给某项竞赛的优胜者按金银铜牌序的时候。 在这个任务中可能的值只有三种1,2和3。我们用交换的方法把他排成升序的。 写一个程序计算出,给定的一个1,2,3组成的数字序列,排成升序所需的最少交换次 阅读全文
posted @ 2018-04-01 15:37 左手边五十米 阅读(200) 评论(0) 推荐(0)
摘要:Description FatMouse prepared M pounds of cat food, ready to trade with the cats guarding the warehouse containing his favorite food, JavaBean. The wa 阅读全文
posted @ 2018-03-28 21:38 左手边五十米 阅读(150) 评论(0) 推荐(0)
摘要:Problem Description Fibonacci numbers are well-known as follow: Now given an integer N, please find out whether N can be represented as the sum of sev 阅读全文
posted @ 2018-03-22 23:12 左手边五十米 阅读(306) 评论(0) 推荐(0)