QOJ.ac

QOJ

时间限制: 1 s 内存限制: 32 MB 总分: 10

#11843. 视频扑克 [A]

统计

Byteman 决定在 Byte Vegas 度过他的假期。在逗留于这座赌博之都期间,他特别喜欢玩视频扑克(Video-Poker)。这是一款需要大量策略思考的游戏。Byteman 希望尽可能多地赢得游戏,因此他请求你编写一个程序来帮助他实现这一目标。

为了玩视频扑克,需要一副标准的 52 张牌(从 2 到 A,四种花色)。游戏仅由一名玩家进行,玩家每局需要支付 1 个字节美元(byte-dollar)。玩家会从牌堆中随机获得五张牌。之后,玩家可以交换任意数量的牌。被交换的牌会被弃掉,玩家会从牌堆中获得相同数量的牌作为补偿。回合结束时,玩家会根据赔率表获得一定数量的字节美元。赔付金额取决于玩家手中持有的牌型。

以下是可区分的牌型(从弱到强):

  • 对子 (Pair) - 两张点数相同的牌。要获得对子的赔付,必须是 J、Q、K 或 A 的对子。
  • 两对 (Two pairs) - 两对(任意点数)。
  • 三条 (Three of a kind) - 三张点数相同的牌。
  • 顺子 (Straight) - 五张点数连续的牌。A 可以作为顺子的一部分,既可以比 K 大,也可以比 2 小,但不能同时兼顾。
  • 同花 (Flush) - 五张花色相同的牌。
  • 葫芦 (Full House) - 三条加一对。
  • 四条 (Four of a kind) - 四张点数相同的牌。
  • 同花顺 (Straight Flush) - 同时满足顺子和同花。
  • 皇家同花顺 (Royal Flush) - 由 A、K、Q、J 和 10 组成的同花顺。

玩家将获得其手中最强牌型的赔付(例如,如果他持有葫芦,那么他也持有对子,但赔付金额等于赔率表中葫芦的价值)。如果玩家没有上述任何牌型,则不会获得任何赔付。

Byteman 想知道针对不同赌场(不同赌场可能使用不同的赔率表)的最佳策略(即最大化期望赔付的策略)。向 Byteman 证明你能计算出这个策略!给定一张赔率表,计算出在最优策略下,有多少种手牌需要保留所有牌,有多少种需要弃掉 1、2、3、4 或 5 张牌。如果多种不同的操作能达到相同的期望赔付,则必须选择需要保留牌数最少的那种操作。

Byteman 给了你一些来自不同赌场的赔率表。你的任务是计算出所有这些赔率表所需的结果。你的程序可以直接输出预计算出的值。

编写一个程序:

  • 从标准输入读取赔率表,
  • 向标准输出写入在最优策略下,分别需要弃掉 0、1、2、3、4 和 5 张牌的手牌数量。

输入格式

标准输入的第一行也是唯一一行定义了赔率表。它包含九个正整数,由空格分隔。它们分别代表对子、两对、三条、顺子、同花、葫芦、四条、同花顺和皇家同花顺的赔付金额。你的程序将使用以下数据集进行测试:

  • 1 2 3 4 6 9 25 50 940
  • 1 2 3 4 5 9 25 50 800
  • 1 2 3 4 6 8 25 50 800
  • 1 2 3 4 5 8 25 50 800
  • 1 2 3 4 5 7 25 50 800
  • 1 2 3 4 5 6 25 50 800
  • 1 2 2 4 6 9 30 125 1000
  • 1 2 2 4 6 9 30 100 1000
  • 1 2 3 4 5 6 25 50 1000
  • 1 2 2 4 6 9 30 100 500

输出格式

在标准输出的第一行,应输出 6 个整数,由空格分隔。它们分别代表在最优策略下,需要弃掉 0、1、2、3、4 和 5 张牌的手牌数量。

样例

输入 1

1 2 3 4 6 9 25 50 800

输出 1

18864 292800 147528 1651440 403968 84360

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.