- 博客(12)
- 收藏
- 关注
原创 完美数
计算前5个完美数 完美数:完全数(Perfect number,又称完美数或完备数)是一些特殊的自然数。它所有的真因子(即除了自身以外的约数)的和(即因子函数),恰好等于它本身。 公式为:(2 ^ (n-1)) * (2 ^ n-1) 2 ^ n - 1 是个素数(梅森素数) 注意:n为素数 (11不算 2 ^ 11 - 1 =23*89 不是素数,所以素数11不能构成完全数) 代...
2019-05-31 17:36:27 859
原创 Shortest path of the king(CodeForces - 3A)
The king is left alone on the chessboard. In spite of this loneliness, he doesn’t lose heart, because he has business of national importance. For example, he has to pay an official visit to square t. ...
2019-05-31 16:45:28 232
原创 L - Median
Output For each test case output one line containing one string of length . If it is possible to assign values to each element so that all the relations are satisfied and the -th element is the media...
2019-05-20 20:31:49 360
原创 F - Stones in the Bucket
Output For each test case output one line containing one integer, indicating the minimum number of times needed to make all the buckets contain the same number of stones. Sample Input 4 3 1 1 0 4 2 2...
2019-05-18 19:49:46 511
原创 D - Game on a Graph
Output For each test case output one line containing one integer. If the 1st group wins, output “1” (without quotes); If the 2nd group wins, output “2” (without quotes). Sample Input 3 5 11212 4 6 0 ...
2019-05-18 19:35:01 313
原创 C - Wandering Robot
Sample Input 2 3 3 RUL 1 1000000000 D Sample Output 4 1000000000 Hint For the first sample test case, the final instruction sequence is “RULRULRUL” and the route of the robot is (0, 0) - (1, 0) - (1...
2019-05-18 19:26:18 334
原创 A - Calandar
Output For each test case output one line containing one string, indicating the day of the -th day in the -th month of year on that planet. Sample Input 4 2019 5 12 Monday 2019 5 14 2019 5 12 Tuesda...
2019-05-18 19:18:59 589
原创 M - Sekiro
Sample Input 4 10 1 7 1 10 2 7 2 Sample Output 5 4 3 2 Hint For the third sample test case, when BaoBao dies for the first time, the money he carries will be reduced from 10 to 5; When he dies for t...
2019-05-18 19:05:46 321
原创 H - Tokens on the Segments
Output For each test case output one line containing one integer, indicating the maximum possible number of segments that have at least one token on each of them. Sample Input 2 3 1 2 1 1 2 3 3 1 2 1...
2019-05-18 18:56:37 712 1
原创 K - Happy Equation
Little Sub has just received an equation, which is shown below, as his birthday gift. Given the value of , please help Little Sub count the number of x(1<=x<=2^p) which satisfies the equation....
2019-05-18 16:58:01 583
原创 Codeforces Round #561 (Div. 2)- 水题(A B C)
A. Silent Classroom 题意:给你n个学生,把他们分成两个班,如果学生的首字母相同,则他们可以交流,问分成两个班后,可以交流的最小数。 思路:所有学生按照字典序排序,统计相同首字母的同学,总数 / 2,第一个班 总数 / 2人,第二个班 总数-总数 / 2人,然后计算和就行了(注意不是用组合数,(a,b )与 (b,a)是一种情况 ) n个人就是 (n-1)+(n-2)+(n-3...
2019-05-18 11:36:37 182
原创 (CodeForces - 771B)Bear and Different Names
In the army, it isn’t easy to form a group of soldiers that will be effective on the battlefield. The communication is crucial and thus no two soldiers should share a name (what would happen if they g...
2019-05-09 21:46:07 164
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人