摘要: Description Saruman the White must lead his army along a straight path from Isengard to Helm’s Deep. To keep track of his forces, Saruman distributes 阅读全文
posted @ 2016-08-19 18:27 Jason杰 阅读(204) 评论(0) 推荐(0)
摘要: Description FJ is about to take his N (1 ≤ N ≤ 2,000) cows to the annual"Farmer of the Year" competition. In this contest every farmer arranges his co 阅读全文
posted @ 2016-08-19 16:49 Jason杰 阅读(150) 评论(0) 推荐(0)
摘要: 实验了一下next_permutation 代码如下 效果如下 阅读全文
posted @ 2016-08-19 16:21 Jason杰 阅读(173) 评论(0) 推荐(0)
摘要: Description Due to recent rains, water has pooled in various places in Farmer John's field, which is represented by a rectangle of N x M (1 <= N <= 10 阅读全文
posted @ 2016-08-19 15:58 Jason杰 阅读(157) 评论(0) 推荐(0)
摘要: Description An army of ants walk on a horizontal pole of length l cm, each with a constant speed of 1 cm/s. When a walking ant reaches an end of the p 阅读全文
posted @ 2016-08-19 15:22 Jason杰 阅读(127) 评论(0) 推荐(0)
摘要: 给你一个n,然后让你输出F(n)规则是这样的,F(n)的输出结果是:F(n-1) F(n-1) F(n-1) F(n-1) F(n-1) F(1)的输出结果是:X那么根据规则F(2)的输出结果应该是:X X X X X 题目有多组输入,每组输入一个n(n<=7)。 当输入零或负数的时候结束输入。 对 阅读全文
posted @ 2016-08-19 12:31 Jason杰 阅读(346) 评论(0) 推荐(0)
摘要: 给定一个大小为n的数组,数组的元素a[i]代表第i天的股票价格。 设计一个算法,计算在最多允许买卖k次(一买一卖记为一次)的条件下的最大收益。 需要注意的是,你不能同时拥有两份股票。也就是说在下次买入前,你必须把手头上原有的股票先卖掉。 输入可能包含多个测试案例。 对于每个测试案例,输入的第一行为两 阅读全文
posted @ 2016-08-19 11:50 Jason杰 阅读(631) 评论(0) 推荐(0)