QOJ.ac

QOJ

حد الوقت: 3.0 s حد الذاكرة: 512 MB مجموع النقاط: 100 تفاعلية

#8619. 交互式赌场

الإحصائيات

这是一个交互式问题。

你初始拥有 $1000$ 美元。你将进行 $T = 1000$ 轮游戏。

在每一轮中,裁判会从范围 $[1..m]$ 中随机选择一个整数 $b$,其中 $m$ 是你当前拥有的金额。该范围内的每个整数被选中的概率相等。你可以选择参与本轮游戏或跳过。如果你选择参与,将以相等的概率发生以下两种结果之一: 你需要支付 $b$ 美元。 裁判给你 $2b$ 美元。

如果在任何时候你的金额超过 $10\,000$ 美元,你获胜。如果你的金额变为 $0$ 美元,或者游戏结束(你已经参与或跳过了全部 $T$ 轮),你失败。

交互格式

第一行包含一个整数 $T$ ($T = 1000$ 或 $T = 5$),表示轮数。保证 $T = 5$ 仅用于样例。如果你的程序在 $T$ 轮后拥有正数金额,则视为通过样例。

每一轮开始时,裁判会发送指令 “ROUND m b”,其中 $m$ 是你当前拥有的金额,$b$ 是裁判为本轮选择的赌注。你应该回复 “PLAY” 或 “SKIP”。请务必在每次回复后刷新输出!

如果在某轮之后你的金额超过 $10\,000$ 美元,你将收到 “WIN” 而不是下一轮的指令。如果你失败了,你将收到 “LOSE”。你的程序在收到 “WIN” 或 “LOSE” 后应立即终止。

样例

输入 1

5
ROUND 1000 43
ROUND 957 433
ROUND 957 525
ROUND 957 125
ROUND 832 685
WIN

输出 1

PLAY
SKIP
SKIP
PLAY
SKIP

说明

本题包含一个样例测试和 $50$ 个正式测试用例。每个正式测试用例都有一个固定的随机种子。请注意,你是否参与某轮游戏会影响随机数生成器的使用,因此之后的所有轮次都会不同。

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.