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

首頁 > 學院 > 開發(fā)設計 > 正文

HDU 5978 To begin or not to begin (簡單博弈--找規(guī)律)

2019-11-10 19:46:39
字體:
供稿:網(wǎng)友

大體題意:

給你k 個黑球和1個紅球,兩個輪流抽,抽到紅球算贏,問先手贏的概率大還是后手大,還是概率相等?

思路:

寫幾個小的數(shù)手算一下 就看到規(guī)律了。

如果k 是偶數(shù)的話,那么先手的概率是 ((n+2)/3)/(n+1)  大于后手的概率 輸出1

如果k 是奇數(shù)的話,那么先手后手概率都是1/2.

#include <cstdio>#include <cstring>#include <algorithm>using namespace std;int main(){	int n;	while(~scanf("%d",&n)){		if (n & 1) puts("0");		else puts("1");	}	return 0;}

To begin or not to begin

Time Limit: 2000/1000 MS (java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 476    Accepted Submission(s): 316PRoblem DescriptionA box contains black balls and a single red ball. Alice and Bob draw balls from this box without replacement, alternating after each draws until the red ball is drawn. The game is won by the player who happens to draw the single red ball. Bob is a gentleman and offers Alice the choice of whether she wants to start or not. Alice has a hunch that she might be better off if she starts; after all, she might succeed in the first draw. On the other hand, if her first draw yields a black ball, then Bob’s chances to draw the red ball in his first draw are increased, because then one black ball is already removed from the box. How should Alice decide in order to maximize her probability of winning? Help Alice with decision. InputMultiple test cases (number of test cases≤50), process till end of input.For each case, a positive integer k (1≤k≤10^5) is given on a single line. OutputFor each case, output:1, if the player who starts drawing has an advantage2, if the player who starts drawing has a disadvantage0, if Alice's and Bob's chances are equal, no matter who starts drawingon a single line. Sample Input
12 Sample Output
01 Source2016ACM/ICPC亞洲區(qū)大連站-重現(xiàn)賽(感謝大連海事大學) Recommendwange2014   |   We have carefully selected several similar problems for you:  6014 6013 6012 6011 6010  


發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 色妇视频| 91精品免费在线 | 蜜桃传媒视频麻豆第一区免费观看 | 操操插插 | 欧美一级黄色免费 | 国产成人在线综合 | 作爱在线观看 | 免费久久精品 | 天天黄色片 | 九九热免费精品 | 国产无遮挡一区二区三区毛片日本 | 在线91视频 | 国产精品久久久久久久四虎电影 | 91成人在线免费视频 | 久久久三区| 91精品国产乱码久久久久久久久 | 成人在线免费看 | 色淫影院 | av在线免费看网址 | 黄污网址| 国产亚洲精品久久久久久久久 | 亚洲精品aa | 亚洲无马在线观看 | 久久亚洲精品国产一区 | 国产品久久 | 一区二区三区欧美在线观看 | 精品国产一区二区三区免费 | 久久新网址 | 午夜在线视频一区二区三区 | 欧美激情第一区 | 毛片在线播放视频 | 成人在线观看免费观看 | 午夜电影视频 | 亚洲国产美女视频 | 黄色网址在线视频 | 久久精品a一级国产免视看成人 | 一级做a爱片性色毛片 | 久久美女免费视频 | 一级黄色在线观看 | 日日摸夜夜添夜夜添牛牛 | 国产91丝袜在线播放 |