Santa Claus and a Place in a Class】的更多相关文章

E. Santa Claus and Tangerines time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Santa Claus has n tangerines, and the i-th of them consists of exactly ai slices. Santa Claus came to a school…
D. Santa Claus and a Palindrome time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Santa Claus likes palindromes very much. There was his birthday recently. k of his friends came to him to co…
E. Santa Claus and Tangerines time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Santa Claus has n tangerines, and the i-th of them consists of exactly ai slices. Santa Claus came to a school…
time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Santa Claus has n tangerines, and the i-th of them consists of exactly ai slices. Santa Claus came to a school which has k pupils. Santa dec…
time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Santa Claus likes palindromes very much. There was his birthday recently. k of his friends came to him to congratulate him, and each of them…
time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Santa Claus has Robot which lives on the infinite grid and can move along its lines. He can also, having a sequence of m pointsp1, p2, ..., …
time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Santa Claus decided to disassemble his keyboard to clean it. After he returned all the keys back, he suddenly realized that some pairs of ke…
time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Santa Claus is the first who came to the Christmas Olympiad, and he is going to be the first to take his place at a desk! In the classroom t…
Santa Claus and a Palindrome 题目链接:http://codeforces.com/contest/752/problem/D 贪心 很自然地,可以想到,若subS不是回文串,那么只要贪心取subS中的最大值和reverse_subS中的最大值,若他们和大于零,则加入到结果回文序列中:而当subS本身就为回文串时,需要分类讨论(可以放在结果回文序列的最中间): 为了方便理解,定义: 若subS中的最大值与次大值的和小于零(或subS中只有一个值),那么称该最大值(或该…
Santa Claus and Tangerines 题目链接:http://codeforces.com/contest/752/problem/E 二分 显然直接求答案并不是很容易,于是我们将其转化为判定性问题:二分解x,验证是否能分成k个x. 于是要点就在于check函数: 由于奇偶的原因,每个ai分出来的并不是2的幂次(比如当ai=11,x=3时,可以将ai分成3部分5,3,3). 但是稍作思考,可以发现还是与2的幂次有关: 例如,当ai=6:48,x=3时, ai part1 part…