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

32021번 - Picking Up the Dice 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB666100.000%

문제

Two players are playing a game with a set of $K$ six-sided dice. One player calls out a number in the range $K\ldots 6K$ and the other tries to roll that number. After the first roll, the player is allowed to pick up any number (0ドル\ldots K$) of dice and re-roll them.

Given the number of dice, the target number the player wants to roll, and the set of numbers the player obtained on the first roll, what number of dice should the player pick up to maximize their chances of getting the target number on the second roll?

입력

Input begins with a line containing 2ドル$ integers, $K,ドル the number of dice, and $T,ドル the target number. 2ドル \leq K \leq 24,ドル $K \leq T \leq 6K$.

The next line contains $K$ integers, indicating the numbers that were rolled on each of the dice on the first roll. All will be integers in the range 1ドル\ldots 6$.

출력

Print a single line containing an integer denoting the number of dice that the roller should pick up and re-roll in order to maximize the chances of getting an overall sum of $T$. (The roller will be able to choose which dice to pick up, but you are only asked to print the number of dice, not which ones.)

If there are more than one numbers of dice that can be picked up to achieve the same probability of getting to $T,ドル print the smallest such value.

제한

예제 입력 1

3 9
5 4 1

예제 출력 1

1

예제 입력 2

4 13
2 2 2 2

예제 출력 2

3

예제 입력 3

18 90
1 2 3 4 5 6 1 2 3 4 5 6 1 2 3 4 5 6

예제 출력 3

12

예제 입력 4

6 21
1 2 3 4 5 6

예제 출력 4

0

힌트

출처

ICPC > Regionals > North America > Mid-Atlantic Regional > 2018 Mid-Atlantic USA Regional Contest F번

ICPC > Regionals > North America > Southern California Regional > 2018 Southern California Regional 11번

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

출처

대학교 대회

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

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