CF98E.Help Shrek and Donkey

省选/NOI-

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Shrek and the Donkey (as you can guess, they also live in the far away kingdom) decided to play a card game called YAGame. The rules are very simple: initially Shrek holds m cards and the Donkey holds n cards (the players do not see each other's cards), and one more card lies on the table face down so that both players cannot see it as well. Thus, at the beginning of the game there are overall m + n + 1 cards. Besides, the players know which cards the pack of cards consists of and their own cards (but they do not know which card lies on the table and which ones the other player has). The players move in turn and Shrek starts. During a move a player can:

  • Try to guess which card is lying on the table. If he guesses correctly, the game ends and he wins. If his guess is wrong, the game also ends but this time the other player wins.
  • Name any card from the pack. If the other player has such card, he must show it and put it aside (so that this card is no longer used in the game). If the other player doesn't have such card, he says about that.

Recently Donkey started taking some yellow pills and winning over Shrek. Now Shrek wants to evaluate his chances to win if he too starts taking the pills.

Help Shrek assuming the pills are good in quality and that both players using them start playing in the optimal manner.

史瑞克和驴子(如你所猜,他们也住在遥远的王国)决定玩一种名为 YAGame 的纸牌游戏。规则非常简单:游戏开始时,史瑞克持有 mm 张牌,驴子持有 nn 张牌(双方均看不到对方的牌),另有一张牌面朝下置于桌面上,双方也都看不到这张牌。因此,游戏开始时一共有 m+n+1m + n + 1 张牌。此外,双方都知道整副牌由哪些牌组成,并且各自清楚自己手中的牌(但他们不知道哪张牌在桌面上,也不知道对方手中有哪些牌)。双方轮流行动,史瑞克先手。每次行动中,玩家可以:

  • 尝试猜测桌面上的牌是哪一张。若猜对,则游戏立即结束,该玩家获胜;若猜错,游戏同样立即结束,但此时对方获胜。
  • 从整副牌中任意报出一张牌。若对方手中恰好有这张牌,则必须将其亮出并移出游戏(即该牌此后不再参与游戏);若对方没有这张牌,则需如实声明。

最近,驴子开始服用一些黄色药丸,并因此屡胜史瑞克。如今,史瑞克希望评估:倘若他自己也开始服用这些药丸,其获胜概率是多少。

请帮助史瑞克进行计算——假设这些药丸品质优良,且双方服药后均以最优策略进行游戏。

输入格式

The first line contains space-separated integers m and n (0 ≤ m, n ≤ 1000).

第一行包含两个用空格分隔的整数 mm 和 nn(0 ≤ m, n ≤ 10000 \le m, n \le 1000)。

输出格式

Print space-separated probabilities that Shrek wins and Donkey wins correspondingly; the absolute error should not exceed 10 - 9.

输出空格分隔的两个概率值,分别表示史莱克获胜和驴子获胜的概率;绝对误差不得超过 10−910^{-9}。

输入输出样例

  • 输入#1

    0 3

    输出#1

    0.25 0.75
  • 输入#2

    1 0

    输出#2

    1 0
  • 输入#3

    1 1

    输出#3

    0.5 0.5

输入解题思路,AI测评打分。不知道怎么写?

首页