编程介的小学生 2019-11-17 22:22 采纳率: 20.5%
浏览 68

Videopoker 的问题的极大

Problem Description
Videopoker is the slot machine variant of the currently immensely popular game of poker. It is a variant on draw poker. In this game the player gets a hand consisting of five cards randomly drawn from a standard 52-card deck. From this hand, the player may discard any number of cards (between 0 and 5, inclusive), and change them for new cards randomly drawn from the remainder of the deck. After that, the hand is evaluated and the player is rewarded according to a payout structure. A common payout structure is as follows:

Once you know the payout structure, you can determine for a given hand which cards you must change to maximize your expected reward. We'd like to know this expected reward, given a hand.

Input
On the first line one positive number: the number of testcases, at most 100. After that per testcase:

  • One line with nine integers xi (0 ≤ xi ≤ 1000$) describing the payout structure. The numbers are in increasing order and describe the payout for one pair, two pair, etc, until the royal flush.
  • One line with one integer n (1 ≤ n ≤ 10): the number of starting hands to follow.
  • n lines, each describing a starting hand. A hand consists of five space separated tokens of the form Xs, with X being the rank (2'...9', T',J', Q',K' or A') and s being the suit (c', d',h' or `s').

Output
Per testcase:

  • One line for each starting hand with a floating point number that is the maximal expected reward for that hand. These numbers must have an absolute or relative error less than 10-6.

Sample Input
1
1 2 3 4 5 10 25 100 250
5
Ah Ac Ad As 2s
Ks Qs Js Ts 2h
Ks Qs 2d 2h 3s
2d 4h 5d 3c 9c
2h 3h 6d 8h Tc

Sample Output
25.000000
8.9574468
1.5467160
0.9361702
0.6608135

  • 写回答

0条回答

    报告相同问题?

    悬赏问题

    • ¥15 R语言Rstudio突然无法启动
    • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像
    • ¥15 改算法,照着压缩包里边,参考其他代码封装的格式 写到main函数里
    • ¥15 用windows做服务的同志有吗
    • ¥60 求一个简单的网页(标签-安全|关键词-上传)
    • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
    • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
    • ¥100 为什么这个恒流源电路不能恒流?
    • ¥15 有偿求跨组件数据流路径图
    • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值