Logo
(追記) (追記ここまで)

3690번 - Videopoker 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB346413.333%

문제

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:

hand payout
one pair 1
two pair 2
three of a kind 3
straight 4
flush 5
full house 10
four of a kind 25
straight flush 100
royal flush 250

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.

입력

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 ≤ 1 000) 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’).

출력

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.

제한

예제 입력 1

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

예제 출력 1

25.000000
8.9574468
1.5467160
0.9361702
0.6608135

힌트

출처

ICPC > Regionals > Europe > Northwestern European Regional Contest > NWERC 2008 K번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /