lightOJ  1317  Throwing Balls into the Baskets(期望)  解题报告 题目链接:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=88890#problem/A 题目: Description You probably have played the game "Throwing Balls into the Basket". It is a simple game. You have…
题目大意:有N个人,M个篮框.K个回合,每一个回合每一个人能够投一颗球,每一个人的命中率都是同样的P.问K回合后,投中的球的期望数是多少 解题思路:由于每一个人的投篮都是一个独立的事件.互不影响.所以每回合投中的球的期望数是同样的 仅仅需求得一回合的期望再乘上K就答案了 #include<cstdio> #define maxn 100 double ans, p; int n, m, k; int c[20][20]; void init() { c[1][1] = c[1][0] = 1;…
n个人 m个篮子 每一轮每一个人能够选m个篮子中一个扔球 扔中的概率都是p 求k轮后全部篮子里面球数量的期望值 依据全期望公式 进行一轮球数量的期望值为dp[1]*1+dp[2]*2+...+dp[n]*n 记为w 当中dp[i]为i个人扔中的概率 dp[i] = C(n, i)*p^i*(1-p)^(n-i) 终于答案为w*k #include <cstdio> #include <cstring> using namespace std; double dp[20]; dou…
题目链接 题意: 有N个人, M个篮框, 每个人投进球的概率是P. 问每个人投K次后, 进球数的期望. 思路: 每个人都是相互独立的, 求出一个人进球数的期望即可. 进球数和篮框的选择貌似没有什么关系, 所以给的这个M并没有什么卵用.... 每个人进球数的期望为:E = sigma (i * C(K, i) * p ^ i * (1 - p) ^ (k - i)); 总的进球数期望为:N * E 代码: #include <cmath> #include <cstdio> #inc…
A - A Time Limit:2000MS     Memory Limit:32768KB     64bit IO Format:%lld & %llu Submit Status Practice LightOJ 1317 Description You probably have played the game "Throwing Balls into the Basket". It is a simple game. You have to throw a bal…
Description You probably have played the game "Throwing Balls into the Basket". It is a simple game. You have to throw a ball into a basket from a certain distance. One day we (the AIUB ACMMER) were playing the game. But it was slightly differen…
A - A Time Limit:2000MS     Memory Limit:32768KB     64bit IO Format:%lld & %llu   Description You probably have played the game "Throwing Balls into the Basket". It is a simple game. You have to throw a ball into a basket from a certain dis…
Time Limit:2000MS     Memory Limit:32768KB     64bit IO Format:%lld & %lluDescription You probably have played the game "Throwing Balls into the Basket". It is a simple game. You have to throw a ball into a basket from a certain distance. On…
链接: https://vjudge.net/problem/LightOJ-1323 题意: You are given a rectangular billiard board, L and W be the length and width of the board respectively. Unlike other billiard boards it doesn't have any pockets. So, the balls move freely in the board. A…
题意:给你n个骰子,求n个骰子的和不小于x的概率. 刚开始想每给一组数就计算一次~~太笨了- -,看了别人的代码,用dp,而且是一次就初始化完成,每次取对应的数据就行了.WA了好多次啊,首先不明白的就是: ;i<=;i++) ;j>=;j--) dp[i][j]+=dp[i][j+]; 这段代码不清楚干什么用的,想清楚没? 刚开始求的dp[i][j]表示的是前 i 个骰子掷出总和为 j 的概率 ,题意让求总和不小于 j 的概率,所以把大于 j 的要加上. 然后输出的又WA了好几次~~ 有概率为…