a亚洲精品_精品国产91乱码一区二区三区_亚洲精品在线免费观看视频_欧美日韩亚洲国产综合_久久久久久久久久久成人_在线区

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

HDU2843 概率論水題

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

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

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;}

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 成人免费一区二区三区视频网站 | 久久视频一区二区 | 亚洲毛片网站 | 中文无码久久精品 | 一区二区三区 在线 | 91精品国产日韩91久久久久久 | 91久久香蕉国产日韩欧美9色 | 亚洲国产一级 | 欧美78videosex性欧美 | 麻豆沈芯语在线观看 | 不卡av电影在线观看 | 91在线精品秘密一区二区 | 国产三区在线观看视频 | 欧美九九 | 久久亚洲综合 | 日韩中文字幕免费在线播放 | 成人久久18免费观看 | 国产精品久久久精品 | av午夜电影 | 亚洲最黄网站 | 久久国产精品无码网站 | 亚洲视频在线观看一区二区三区 | 一区不卡| 嫩草私人影院 | 欧美国产精品一区 | 高清视频一区二区 | 特级毛片在线 | 国产精品电影 | 日本xxxxxxxxxxxxxxx | 亚洲天天av | 久久99精品久久久 | 一区二区三区四区av | 一区二区三区av | 亚洲成人黄色 | 黄色一级片视频 | 精品国产乱码久久久久久1区2区 | 亚洲欧美日韩另类精品一区二区三区 | 成人黄色小视频 | 国产成人精品一区二区 | 日韩国产欧美视频 | 国产精品久久久久久久久久三级 |