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

34303번 - Winning Wagers 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 2048 MB42342982.857%

문제

You and your friend finish the Physics I studio early one day. After completing an invigorating set of rotational motion problems, you decide to make some wagers based on event-driven probability (instead of getting a head-start on the homework for that week).

After rummaging through the lockers and desks in the studio room (with permission from the TAs, of course), you and your friend were able to gather the following probability items: a coin, an six-sided die, and a standard deck of 52ドル$ cards.

You and your friend decide on the following rules for the friendly competition: a wager must consist of a series of discrete events from at least one of the probability items. Each probability item has only one discrete event associated with it:

  • COIN: Obtaining either a "heads" or "tails" on a single flip.
  • DIE: Rolling a particular number (1ドル$-6ドル$) on the six-sided die.
  • CARDS: Drawing one particular card out of the 52ドル$ card deck with replacement.

Your friend will be offering you a wager. If you win the wager, your friend will give you $W$ dollars. If you lose, you'll need to pay your friend $L$ dollars.

For you to win the wager, you'll need to guess the outcome of each discrete event correctly. For example, if your friend offers you a wager that consists of flipping the coin, rolling the die, and drawing from the deck, you'll win only if you correctly guess which side the coin landed on, correctly guess which number was rolled on the die, and correctly guess the exact suit and face value of the card that was chosen. If you guess any outcome incorrectly, you'll lose the wager.

Your friend states the wager, and $L$ (the amount of money that you'll need to pay if you lose). You need to calculate a value for $W$ (the amount of money that your friend will pay you if you win the wager) such that the amount you win on average is zero.

입력

The first line of input is an integer, 1ドル \leq N \leq 8,ドル representing the number of discrete events composing the wager.

The second line of input is a space-separated list of $N$ probability item strings, each representing it's corresponding discrete event.

The third and final line of input will be an integer, 1ドル \leq L \leq 10^4,ドル corresponding to the amount of money that you'll need to pay your friend if you lose.

출력

Output a single integer $W$ (the amount of money that your friend will pay you if you win the wager) such that the amount you win on average is zero.

제한

예제 입력 1

1
DIE
1

예제 출력 1

5

예제 입력 2

3
COIN DIE CARDS
250

예제 출력 2

155750

예제 입력 3

2
CARDS CARDS
12

예제 출력 3

32436

힌트

출처

School > CS@Mines > CS@Mines HSPC 2024 G번

  • 문제를 만든 사람: Umberto Gherardi
(追記) (追記ここまで)

출처

대학교 대회

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

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