A - Alice's Print Service Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Submit Status Practice HDU 4791 Description Alice is providing print service, while the pricing doesn't seem to be reasonable, so people using her…
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=5568 Edge to the Root Time Limit: 1 Second Memory Limit: 131072 KB Given a tree with n vertices, we want to add an edge between vertex 1 and vertex x, so that the sum of d(1, v) for all…
题意:1-n个位置中,每个位置填一个数,问至少有l个数是相同的概率. 可以转化求最多有l-1个数是相同的. dp[i][j]表示前i个位置填充j个位置的方案数,并且要满足上面的条件. 则: dp[i][j]=∑dp[i-1][j-k]*c[m-j+k][k]; 也就是看第i个数,可以不填,填一个位置,两个位置······这样累加过来. 代码如下: import java.math.*; import java.util.*; public class Main { public static v…