light oj 1248 第六周E题(期望)】的更多相关文章

E - 期望(经典问题) Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%lld & %llu   Description Given a dice with n sides, you have to find the expected number of times you have to throw that dice to see all its faces at least once. Assume that…
F - 概率(经典问题) Time Limit:2000MS     Memory Limit:32768KB     64bit IO Format:%lld & %llu   Description Sometimes some mathematical results are hard to believe. One of the common problems is the birthday paradox. Suppose you are in a party where there…
Description Given a dice with n sides, you have to find the expected number of times you have to throw that dice to see all its faces at least once. Assume that the dice is fair, that means when you throw the dice, the probability of occurring any fa…
第六周编程题 依照学术诚信条款,我保证此作业是本人独立完成的. 1 单词长度(4分) 题目内容: 你的程序要读入一行文本,其中以空格分隔为若干个单词,以'.'结束.你要输出这行文本中每个单词的长度.这里的单词与语言无关,可以包括各种符号,比如"it's"算一个单词,长度为4.注意,行中可能出现连续的空格. 输入格式: 输入在一行中给出一行文本,以'.'结束,结尾的句号不能计算在最后一个单词的长度内. 输出格式: 在一行中输出这行文本对应的单词的长度,每个长度之间以空格隔开,行末没有最后…
第六周H题 - 数论,晒素数 Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u   Description 小明对数的研究比较热爱,一谈到数,脑子里就涌现出好多数的问题,今天,小明想考考你对素数的认识.  问题是这样的:一个十进制数,如果是素数,而且它的各位数字和也是素数,则称之为“美素数”,如29,本身是素数,而且2+9 = 11也是素数,所以它是美素数.  给定一个区间,你能计算出这个区间…
Description Gerald got a very curious hexagon for his birthday. The boy found out that all the angles of the hexagon are equal to . Then he measured the length of its sides, and found that each of them is equal to an integer number of centimeters. Th…
t组样例 n<100010 dp[i]  从i翻到n面的期望 接下来翻 可能是i面已经有的 也可能是n-i面没有的 dp[i]=i/n*(dp[i]+1)+(n-i)/n*(dp[i+1]+1); dp[n]=0; #include<stdio.h> #include<algorithm> #include<string.h> #include<math.h> using namespace std; #define MAXN 100010 doubl…
Description As Harry Potter series is over, Harry has no job. Since he wants to make quick money, (he wants everything quick!) so he decided to rob banks. He wants to make a calculated risk, and grab as much money as possible. But his friends - Hermi…
Description 大家常常感慨,要做好一件事情真的不容易,确实,失败比成功容易多了!  做好“一件”事情尚且不易,若想永远成功而总从不失败,那更是难上加难了,就像花钱总是比挣钱容易的道理一样.  话虽这样说,我还是要告诉大家,要想失败到一定程度也是不容易的.比如,我高中的时候,就有一个神奇的女生,在英语考试的时候,竟然把40个单项选择题全部做错了!大家都学过概率论,应该知道出现这种情况的概率,所以至今我都觉得这是一件神奇的事情.如果套用一句经典的评语,我们可以这样总结:一个人做错一道选择题…
Description Tomorrow is contest day, Are you all ready?  We have been training for 45 days, and all guys must be tired.But , you are so lucky comparing with many excellent boys who have no chance to attend the Province-Final. Now, your task is relaxi…