麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁 > 學院 > 開發設計 > 正文

HDU2843 概率論水題

2019-11-14 10:54:57
字體:
來源:轉載
供稿:網友

啦啦啦啦啦     我是傳送門,快點我看題目

I Will Win

Time Limit: 2000/1000 MS (java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 398    Accepted Submission(s): 246PRoblem DescriptionDumbear likes to play table tennis with his daughter – Quan. But Dumbear found that Quan played table tennis better and better recently, Dumbear wondered that Quan would defeat him someday. So he wants to know if he will win in the next match.To simplify the problem, you can assume that the probability of Dumbear’s winning in each match is a constant number P (But Dumbear and you don’t know the number exactly). Of course 0 ≤ P ≤ 1. Dumbear had already taken N matches with Quan. And he won for M matches. He wants to know the expected probability of his winning for the next match. But Dumbear is very dumb, so he wants you to help him. InputEach line of the input file contains two numbers N and M (0 ≤ M ≤ N) indicate the number of the matches Dumbear had taken and the number of matches Dumbear had won. The last line of the input file contains two numbers "0 0". OutputFor each line, output two integers A and B indicates the expected probability of Dumbear’s winning for the next match is A / B. Make sure that gcd(A, B) = 1! Sample Input
1 12 10 0 Sample Output
2 31 2

題目大意:有個小孩和爸爸一起打乒乓球,小孩越打越好,爸爸就有點擔心了,想知道自己下一局贏的期望概率*.*,給你他們比賽的局數n,爸爸贏的局數m,要你求P,P的分子為A,分母為B

你們看  公式就是這么簡單[轉載][HDU <wbr>2843][TJU <wbr>3319] <wbr>I <wbr>Will <wbr>Win,具體推導詳見百度,我們怎么樣求最簡分數呢,當然是用gcd咯,具體代碼如下:

#include <iostream>using namespace std;int gcd(int x,int y){	if (y==0) return x;	if(x<y)		return gcd(y,x);	else		return gcd(y,x%y);}int main(){	int n,m,a,b;	while(cin>>n>>m)	{		if(n==0&&m==0)			break;		a=m+1;		b=n+2;		int t=gcd(a,b);		a=a/t;		b=b/t;		cout<<a<<" "<<b<<endl;	}	return 0;}

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: a黄网站| 亚洲一区二区中文字幕在线观看 | 免费久久精品 | 激情av在线 | 国产亚洲精品久久久久婷婷瑜伽 | asiass极品裸体女pics | 国产色妞影院wwwxxx | 黄色三级三级三级 | 国产伦精品一区二区三区 | 国产精品午夜未成人免费观看 | 毛片大全免费 | 日韩视频一区在线 | 欧美日韩视频在线播放 | 一级爱爱| av电影在线网站 | 久久精品.com | 久久经典免费视频 | av免费在线观看免费 | 成人做爰高潮片免费视频美国 | 精品一区二区久久久久久久网精 | 免费国产视频大全入口 | 韩国一大片a毛片 | 黄色片免费视频 | av电影手机在线看 | 九九热精品免费视频 | 羞羞视频免费网站 | 亚洲日本欧美 | 成人在线第一页 | 一区二区久久精品66国产精品 | 一级成人欧美一区在线观看 | 99热久草 | 精品亚洲在线 | 午夜爱爱福利 | 久久精品视频2 | 免费的性生活视频 | 久久99精品久久久久久园产越南 | 黄色小视频免费在线观看 | 国产一区二精品区在线 | 欧美成人精品一区 | 亚洲精品一区中文字幕 | 最新亚洲国产 |