Problem 2278 YYS (FZU + java大数)】的更多相关文章

题目链接:http://acm.fzu.edu.cn/problem.php?pid=2278 题目: 题意: 有n种卡牌,每种卡牌被抽到的概率为1/n,求收齐所有卡牌的天数的期望. 思路: 易推得公式为: 由于n的范围太大,直接求阶乘会爆,所以我们得用大数来求~ 代码实现如下: import java.math.BigInteger; import java.util.Scanner; public class Main { public static void main(String arg…
题目链接: G - YYS FZU - 2278 题目大意: 我们现在想要收集到n个卡片,现在已知抽到每种卡片的概率为1/n,现在每隔(n-1)!天就可以进行一次抽奖,问收集齐所有卡片的期望天数. 具体思路: 第一天获得一张新的卡片的概率是n/n,第二天获得新的卡片的概率是(n-1)/n.然后来分析一波第二天的概率,(n-1)/n代表的是当从n-1张抽出除了第一张以外的,都是满足条件的.打个比方,如果是抽中的概率是3/5,那么也就是说 抽(5/3)张一定能中.那么第二天的期望类比,也就是第二天的…
JAVA大数类api http://man.ddvip.com/program/java_api_zh/java/math/BigInteger.html#method_summary 不仅仅只能查JAVA大数类的API.总结的东西都可以查询. 大数类基本语法 详细见这:http://www.babytree.com/user/showuser.php?uid=u60610804477&tab=journal&journalid=6811716&view=single  HDU47…
Cut the Cake Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1102    Accepted Submission(s): 540 Problem Description MMM got a big big big cake, and invited all her M friends to eat the cake tog…
N! Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 73503    Accepted Submission(s): 21308 Problem Description Given an integer N(0 ≤ N ≤ 10000), your task is to calculate N!   Input One N in…
  HDU1002   A + B Problem II [题意]大数相加 [链接]http://acm.hdu.edu.cn/showproblem.php?pid=1002 Sample Input 2 1 2 112233445566778899 998877665544332211   Sample Output Case 1: 1 + 2 = 3 Case 2: 112233445566778899 + 998877665544332211 = 1111111111111111110…
传送门 FXTZ II Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 530    Accepted Submission(s): 280 Problem Description Cirno is playing a fighting game called "FXTZ" with Sanae. Sanae is a ChuS…
java大数还是很好用的! 基本加入: import java.math.BigInteger; import jave.math.BigDecimal; 分别是大数和大浮点数. 首先读入可以用: Scanner input = new Scanner(System.in); BigInteger a = input.nextBigInteger(); 这样读还是很方便的 当然还有自己创建: BigInteger a = new BigInteger("1"); int b=1; Bi…
java大数是个好东西,用起来方便,代码短. 代码如下: import java.util.*; import java.math.*; public class Main { public static void main(String args[]) { Scanner cin = new Scanner(System.in); BigInteger a , b; while(cin.hasNext()) { a = cin.nextBigInteger(); b = cin.nextBig…
java大数(2013长春网络赛)--hdu4762总结一下:1.java提交类要写Main.2.读取大数. Scanner read=new Scanner(System.in); BigInteger m: m=read.nextBigInteger(); 3.基本类型转化成大数. BigInteger q=BigInteger.valueOf(n); 4.大数最大公约数: BigInteger a=p.gcd(q); 5.finally函数只能写在try-catch后面 import ja…