LightOJ 1317 - Throwing Balls into the Baskets
2017-07-31 16:47
761 查看
1317 - Throwing Balls into the Baskets
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 different from
the main game. In our game we were N people trying to throw balls into M identical Baskets. At each turn we all were selecting a basket and trying to throw a ball into it. After the game we saw exactly S balls
were successful. Now you will be given the value of N and M. For each player probability of throwing a ball into any basket successfully is P. Assume that there are infinitely many balls and the probability
of choosing a basket by any player is 1/M. If multiple people choose a common basket and throw their ball, you can assume that their balls will not conflict, and the probability remains same for getting inside a basket. You have to find the
expected number of balls entered into the baskets after K turns.
Each case starts with a line containing three integers N (1 ≤ N ≤ 16), M (1 ≤ M ≤ 100) and K (0 ≤ K ≤ 100) and a real number P (0 ≤ P ≤ 1). P contains at most three places after the decimal
point.
PROBLEM SETTER: MUHAMMAD RIFAYAT SAMEE
SPECIAL THANKS: JANE ALAM JAN
题目大意:每一轮中,有n个人各执一球往m个篮子里扔球,各自的扔中概率皆为p,问k轮之后中球的期望。
思路:每一轮里每个人中秋的期望为p,n个人就为n*p,k轮之后的总期望为k*(n*p);
ac代码:
总结:理解题意,注意输出是%f。
题目链接
PDF (English) | Statistics | Forum |
Time Limit: 2 second(s) | Memory Limit: 32 MB |
the main game. In our game we were N people trying to throw balls into M identical Baskets. At each turn we all were selecting a basket and trying to throw a ball into it. After the game we saw exactly S balls
were successful. Now you will be given the value of N and M. For each player probability of throwing a ball into any basket successfully is P. Assume that there are infinitely many balls and the probability
of choosing a basket by any player is 1/M. If multiple people choose a common basket and throw their ball, you can assume that their balls will not conflict, and the probability remains same for getting inside a basket. You have to find the
expected number of balls entered into the baskets after K turns.
Input
Input starts with an integer T (≤ 100), denoting the number of test cases.Each case starts with a line containing three integers N (1 ≤ N ≤ 16), M (1 ≤ M ≤ 100) and K (0 ≤ K ≤ 100) and a real number P (0 ≤ P ≤ 1). P contains at most three places after the decimal
point.
Output
For each case, print the case number and the expected number of balls. Errors less than 10-6 will be ignored.Sample Input | Output for Sample Input |
2 1 1 1 0.5 1 1 2 0.5 | Case 1: 0.5 Case 2: 1.000000 |
PROBLEM SETTER: MUHAMMAD RIFAYAT SAMEE
SPECIAL THANKS: JANE ALAM JAN
题目大意:每一轮中,有n个人各执一球往m个篮子里扔球,各自的扔中概率皆为p,问k轮之后中球的期望。
思路:每一轮里每个人中秋的期望为p,n个人就为n*p,k轮之后的总期望为k*(n*p);
ac代码:
#include<stdio.h> int main() { int t,n,m,k,cas=0; double p; scanf("%d",&t); while(t--) { scanf("%d%d%d%lf",&n,&m,&k,&p); printf("Case %d: %f\n",++cas,n*p*k); } return 0; }
总结:理解题意,注意输出是%f。
题目链接
相关文章推荐
- Throwing Balls into the Baskets LightOJ - 1317 (巨水水题)
- LightOJ 1317 Throwing Balls into the Baskets
- LightOJ - 1317 Throwing Balls into the Baskets 期望
- lightOJ 1317 Throwing Balls into the Baskets
- lightoj 1317 Throwing Balls into the Baskets
- LightOJ1317---Throwing Balls into the Baskets (概率dp)
- lightOJ 1317 - Throwing Balls into the Baskets
- Throwing Balls into the Baskets LightOJ - 1317
- LightOJ - 1317 Throwing Balls into the Baskets 期望
- Light OJ 1317 Throwing Balls into the Baskets 概率DP
- Light OJ 1317 Throwing Balls into the Baskets 概率DP
- Throwing Balls into the Baskets (概率)
- LightOJ1317-Throwing Balls into the Baskets
- sgu183:Painting the balls(dp+优化)
- chaussures nike air max thea baskets
- "Cannot load C:/php/php5apache2.dll into server: "或者:"The requested operation has failed"
- UVALive 5002/ lightoj 1382 The Queue(树形DP)
- LightOj 1251 Forming the Council(2-sat)
- lightoj 1374 - Confusion in the Problemset 贪心
- LightOJ-1342 Aladdin and the Magical Sticks(期望dp)