摘要: We all know the impressive story of Robin Hood. Robin Hood uses his archery skills and his wits to steal the money from rich, and return it to the poo 阅读全文
posted @ 2017-12-03 18:14 小小超plus 阅读(282) 评论(0) 推荐(0) 编辑
摘要: Farmer John has arranged his N (1 ≤ N ≤ 5,000) cows in a row and many of them are facing forward, like good cows. Some of them are facing backward, th 阅读全文
posted @ 2017-12-03 18:13 小小超plus 阅读(168) 评论(0) 推荐(0) 编辑
摘要: 现在有两个长度为n的排列p和s。要求通过交换使得p变成s。交换 pipi 和 pjpj 的代价是|i-j|。要求使用最少的代价让p变成s。 Input单组测试数据。 第一行有一个整数n (1≤n≤200000),表示排列的长度。 第二行有n个范围是1到n的整数,表示排列p。每个整数只出现一次。 第三 阅读全文
posted @ 2017-12-03 18:13 小小超plus 阅读(109) 评论(0) 推荐(0) 编辑
摘要: A sequence of N positive integers (10 < N < 100 000), each of them less than or equal 10000, and a positive integer S (S < 100 000 000) are given. Wri 阅读全文
posted @ 2017-12-03 18:12 小小超plus 阅读(135) 评论(0) 推荐(0) 编辑
摘要: Farmer John has built a new long barn, with N (2 <= N <= 100,000) stalls. The stalls are located along a straight line at positions x1,...,xN (0 <= xi 阅读全文
posted @ 2017-12-03 18:11 小小超plus 阅读(225) 评论(0) 推荐(0) 编辑
摘要: 数组A和数组B,里面都有n个整数。数组C共有n^2个整数,分别是A00 * B00,A00 * B11......A11 * B00,A11 * B11......An−1n−1 * Bn−1n−1(数组A同数组B的组合)。求数组C中第K大的数。 例如:A:1 2 3,B:2 3 4。A与B组合成的 阅读全文
posted @ 2017-12-03 18:10 小小超plus 阅读(326) 评论(0) 推荐(0) 编辑
摘要: You are going out for a walk, when you suddenly encounter N monsters. Each monster has a parameter called health, and the health of the i-th monster i 阅读全文
posted @ 2017-12-03 18:08 小小超plus 阅读(325) 评论(0) 推荐(0) 编辑
摘要: David the Great has just become the king of a desert country. To win the respect of his people, he decided to build channels all over his country to b 阅读全文
posted @ 2017-12-03 18:07 小小超plus 阅读(114) 评论(0) 推荐(0) 编辑
摘要: In a certain course, you take n tests. If you get ai out of bi questions correct on test i, your cumulative average is defined to be . Given your test 阅读全文
posted @ 2017-12-03 18:05 小小超plus 阅读(189) 评论(0) 推荐(0) 编辑
摘要: 给定一个0-1串,请找到一个尽可能长的子串,其中包含的0与1的个数相等。 给定一个0-1串,请找到一个尽可能长的子串,其中包含的0与1的个数相等。 Input 一个字符串,只包含01,长度不超过1000000。 Output 一行一个整数,最长的0与1的个数相等的子串的长度。 Input示例 101 阅读全文
posted @ 2017-12-03 18:03 小小超plus 阅读(175) 评论(0) 推荐(0) 编辑
摘要: N堆石子摆成一条线。现要将石子有次序地合并成一堆。规定每次只能选相邻的2堆石子合并成新的一堆,并将新的一堆石子数记为该次合并的代价。计算将N堆石子合并成一堆的最小代价。 例如: 1 2 3 4,有不少合并方法 1 2 3 4 => 3 3 4(3) => 6 4(9) => 10(19) 1 2 3 阅读全文
posted @ 2017-12-03 18:02 小小超plus 阅读(175) 评论(0) 推荐(0) 编辑
摘要: 第二次世界大战时期,英国皇家空军从沦陷国征募了大量外籍飞行员。由皇家空军派出的每一架飞机都需要配备在航行技能和语言上能互相配合的2名飞行员,其中1名是英国飞行员,另1名是外籍飞行员。在众多的飞行员中,每一名外籍飞行员都可以与其他若干名英国飞行员很好地配合。如何选择配对飞行的飞行员才能使一次派出最多的 阅读全文
posted @ 2017-12-03 17:59 小小超plus 阅读(198) 评论(0) 推荐(0) 编辑