A simple greedy problem(hdu 4976)】的更多相关文章

题意:有n个小兵,每个小兵有a[i]血量,第一个人每次只能对一个小兵砍一滴血,第二个人每次对所有生存的小兵砍一滴血. 最后看第一个人最多可以砍杀几个小兵. /* 首先,如果所有小兵的血量都不同的话,我们可以杀死所有的小兵,如果所以我们应该尽量使小兵血量不同, 也就是在不能将某个小兵一击致命的情况下,对某个某个血量相同的小兵砍一刀,使其血量不同. 预处理出c[i]表示i血量这个位置上的小兵是由c[i]血量的小兵砍过来的. dp[i][j]表示进行了i轮之后,留有的砍兵机会为j次的最大值. dp[i…
http://acm.hdu.edu.cn/showproblem.php?pid=4976 2014 Multi-University Training Contest 10 1006 A simple greedy problem. Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 20    Accepted Submission(s…
A Simple Math Problem Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1697    Accepted Submission(s): 959 Problem Description Lele now is thinking about a simple function f(x). If x < 10 f(x) =…
题目描述: Given two positive integers a and b,find suitable X and Y to meet the conditions: X+Y=a Least Common Multiple (X, Y) =b Input Input includes multiple sets of test data.Each test data occupies one line,including two positive integers a(1≤a≤2*10^…
If x < 10 f(x) = x.If x >= 10 f(x) = a0 * f(x-1) + a1 * f(x-2) + a2 * f(x-3) + …… + a9 * f(x-10);And ai(0<=i<=9) can only be 0 or 1 . Sample Input 10 9999 1 1 1 1 1 1 1 1 1 1 20 500 1 0 1 0 1 0 1 0 1 0   Sample Output 45 104 #include <iostr…
Problem Description Lele now is thinking about a simple function f(x).If x < 10 f(x) = x.If x >= 10 f(x) = a0 * f(x-1) + a1 * f(x-2) + a2 * f(x-3) + -- + a9 * f(x-10);And ai(0<=i<=9) can only be 0 or 1 .Now, I will give a0 ~ a9 and two positiv…
2013-07-30 20:35 388人阅读 评论(0) 收藏 举报 http://acm.hdu.edu.cn/showproblem.php?pid=4627 The Unsolvable Problem Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 230    Accepted Submission(s): 136 Prob…
Description Given a rooted tree, each node has a boolean (0 or 1) labeled on it. Initially, all the labels are 0. We define this kind of operation: given a subtree, negate all its labels. And we want to query the numbers of 1's of a subtree. Input Mu…
//========================== 蒟蒻Macaulish:http://www.cnblogs.com/Macaulish/  转载要声明! //========================== 说好的“因为是OJ上的题,就简单点好了.”呢? 一开始看不懂,不会写. 然后跪了一个晚上决定看云的题解&……似乎是主席树套主席树!吓傻,还开了40000000的数组.然后一交tle…… 然后p是不可能玩常数的. 找不到其他做法. 然后找到了神牛dwjshift,好心地提供了题…
Problem Description Jam has a math problem. He just learned factorization. He is trying to factorize ax^2+bx+cax​2​​+bx+c into the form of pqx^2+(qk+mp)x+km=(px+k)(qx+m)pqx​2​​+(qk+mp)x+km=(px+k)(qx+m). He could only solve the problem in which p,q,m,…