QOJ.ac

QOJ

时间限制: 1.0 s 内存限制: 512 MB 总分: 100 交互 可 Hack ✓

#7533. 危险的博弈

统计

这是一个交互式问题。

在淘汰赛中,两支队伍进行比赛,直到其中一支队伍赢得 $N$ 场比赛为止。比赛没有平局,因此每场比赛都以其中一支队伍的胜利而告终。

你支持的队伍正在参加其中一场比赛,你希望押注该队伍赢得整个系列赛。赌注的规则如下:如果你的队伍赢得了系列赛,你将获得双倍的赌注返还;如果输掉系列赛,则没有任何返还。

然而,你使用的博彩公司希望你尽可能多地进行投注。他们没有提供对整个系列赛结果进行投注的机会,而是要求你对每一场比赛分别进行投注。

但你没有放弃,接受了博彩公司的挑战。你希望对每一场比赛进行投注,使得在系列赛结束时,你拥有的资金要么翻倍(如果你的队伍获胜),要么全部输光(如果你的队伍失败)。

交互

首先,你的程序必须读取一个整数 $N$ —— 赢得系列赛所需的胜场数 ($1 \le N \le 30$)。

你初始拥有的资金为 $2^{2 \cdot N}$。

然后,你的程序必须对系列赛的第一场比赛进行投注。为了投注,你需要打印一行,包含一个整数 $b$ —— 用于投注的金额。$b$ 的值必须严格大于 0,且不能超过你当前拥有的资金总额。

投注过程如下进行:

在下注后,评测程序会告诉你比赛的结果: Won —— 表示你的队伍获胜,你将获得双倍的赌注返还。 Lost —— 表示你的投注失败,资金将不会返还给你。

如果在下一场比赛后,其中一支队伍达到了 $N$ 胜,则系列赛结束,你的程序应当退出。

如果系列赛继续,则你必须对下一场比赛进行投注。

保证一定存在一种投注序列可以完成任务。

请确保在打印每个赌注后,打印换行符并刷新输出流缓冲区(使用语言对应的 flush 命令)。否则,你的程序可能会得到“超出空闲时间限制”(idleness limit exceeded)的判决。

样例

输入 1

3
Lost
Won
Won
Won

输出 1

40
20
40
44

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.