HDU4762 Cut the Cake】的更多相关文章

HDU4762 Cut the Cake 思路:公式:n/m(n-1) //package acm; import java.awt.Container; import java.awt.geom.AffineTransform; import java.math.*; import java.util.*; import javax.swing.tree.TreeNode; import org.omg.PortableServer.ID_ASSIGNMENT_POLICY_ID; publi…
Cut the Cake Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 263    Accepted Submission(s): 113 Problem Description MMM got a big big big cake, and invited all her M friends to eat the cake toge…
  MMM got a big big big cake, and invited all her M friends to eat the cake together. Surprisingly one of her friends HZ took some (N) strawberries which MMM likes very much to decorate the cake (of course they also eat strawberries, not just for dec…
Cut the Cake Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 300    Accepted Submission(s): 135 Problem Description MMM got a big big big cake, and invited all her M friends to eat the cake toge…
Cut the Cake Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1657    Accepted Submission(s): 806 Problem Description MMM got a big big big cake, and invited all her M friends to eat the cake tog…
Cut the cake Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1250    Accepted Submission(s): 489 Problem Description: Mark bought a huge cake, because his friend ray_sun’s birthday is coming. Ma…
猜公式: ans=n/m^(n-1) #include<stdio.h> #include<string.h> struct BigNum { ]; int len; }; int gcd(int a,int b) { ) return a; return gcd(b,a%b); } BigNum mul(BigNum &a,int b) { BigNum c; int i,len; len=a.len; memset(c.num,,sizeof(c.num)); ) {…
将原问题转化为求完全由1组成的最大子矩阵.挺经典的通过dp将n^3转化为n^2. /* 4328 */ #include <iostream> #include <sstream> #include <string> #include <map> #include <queue> #include <set> #include <stack> #include <vector> #include <deq…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4762 题目大意:将n个草莓随机放在蛋糕上,草莓被看做是点,然后将蛋糕平均切成m份,求所有草莓在同一块蛋糕上的概率 Sample Input 2 3 3 3 4   Sample Output 1/3 4/27 分析:计算出这个概率公式为:n/(mn-1),m.n最大为20,mn超出了64位,用到大数,用java容易写出 代码如下: import java.math.BigInteger; impor…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4762 题目大意:一个圆形蛋糕,现在要分成M个相同的扇形,有n个草莓,求n个草莓都在同一个扇形上的概率. 算法思路:n个草莓在圆形上有一个最左边的,为了好理解,先把假设草莓有1-n的不同编号.  现在从n个草莓中选出一个编号A的放在最左边(这个最左边可以随便放),得到C(n,1)*1.然后把其余的n-1草莓不分先后的放在A的右边角大小为(360)/m的扇形区域内就可以了. 所以概率为 n/(m^(n-…