//yy:那天考完概率论,上网无聊搜个期望可加性就搜到这题,看到以后特别有亲和感,挺有意思的. hdu5194 DZY Loves Balls [概率论 or 搜索] 题意: 一个盒子里有n个黑球和m个白球[n,m≤12].每次随机从盒子里取走一个球,取了n+m次后,刚好取完.现在用一种方法生成了一个随机的01串S[1…(n+m)],如果第i次取出的球是黑色的,那么S[i]=1,如果是白色的,那么S[i]=0.求'01'在S串中出现的期望次数. 题解: 求出在第i个位置上出现0,第i+1个位置上…
DZY Loves Balls Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 807    Accepted Submission(s): 439 Problem Description There are n black balls and m white balls in the big box. Now, DZY starts…
DZY Loves Balls  Accepts: 659  Submissions: 1393  Time Limit: 4000/2000 MS (Java/Others)  Memory Limit: 262144/262144 K (Java/Others) 问题描述 DZY喜欢玩球. 他有nn个球,装进一个大盒子里.每个球上面都写着一个整数. 有一天他打算从盒子中挑两个球出来.他先均匀随机地从盒子中挑出一个球,记为AA.他不把AA放回盒子,然后再从盒子中均匀随机地挑出一个球,记为BB.…
DZY Loves Balls 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5645 Description DZY loves playing balls. He has n balls in a big box. On each ball there is an integer written. One day he decides to pick two balls from the box. First he randomly pick…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5194 题意:给你n个黑球,m个白球,每次从中随机抽取一个,如果抽到黑球记为1如果抽出来白球记为0,让你输出所有的可能性总数q和将这些组合中01出现的次数q,将q和p以q/p的形式输出最简形式 竟然就这样过了,只是看到了这个规律试试而已 #include<stdio.h> #include<string.h> #include<algorithm> #define MAX 1…
DZY Loves Balls  Accepts: 659  Submissions: 1393  Time Limit: 4000/2000 MS (Java/Others)  Memory Limit: 262144/262144 K (Java/Others) 问题描述 DZY喜欢玩球. 他有nn个球,装进一个大盒子里.每个球上面都写着一个整数. 有一天他打算从盒子中挑两个球出来.他先均匀随机地从盒子中挑出一个球,记为AA.他不把AA放回盒子,然后再从盒子中均匀随机地挑出一个球,记为BB.…
DZY Loves Chessboard time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output DZY loves chessboard, and he enjoys playing with it. He has a chessboard of n rows and m columns. Some cells of the ches…
3512: DZY Loves Math IV 题意:求\(\sum_{i=1}^n \sum_{j=1}^m \varphi(ij)\),\(n \le 10^5, m \le 10^9\) n较小,考虑写成前缀和的形式,计算\(S(n,m)=\sum_{i=1}^m \varphi(in)\) 一开始想出 \[ n= \prod_i p_i,\ \varphi(in) = \varphi(i) \cdot \varphi(\frac{n}{d})\cdot d,\ d=(n,i) \] 比较…
Problem Description DZY loves playing balls. He has n balls in a big box. On each ball there is an integer written. One day he decides to pick two balls from the box. First he randomly picks a ball from the box, and names it A. Next, without putting …
C. DZY Loves Colors time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output DZY loves colors, and he enjoys painting. On a colorful day, DZY gets a colorful ribbon, which consists of n units (they…