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

6946번 - Golf 다국어

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

문제

Roberta the Robot plays a perfect game of golf. When she hits the golf ball it always goes directly towards the hole on the green, and she always hits exactly the distance that is specified for the club. Each such action is known as a stroke, and the object of golf is to hit the ball from the tee to the hole in the fewest number of strokes. Roberta needs a program to select the best combination of clubs to reach the hole in the fewest strokes. She also needs to decide if the task is impossible, in which case she graciously acknowledges the loss. Roberta can carry up to 32ドル$ clubs, and the total distance from the tee to the hole does not exceed 5ドル,280円$ metres.

입력

The first line of input gives the distance from the tee to the hole, an integral number of metres between 1ドル$ and 5ドル,280円$. The next line states the number of clubs, between 1ドル$ and 32ドル$. For each club, a line follows giving the distance, in metres, that the club will hit the ball, an integer between 1ドル$ and 100ドル$. No two clubs have the same distance.

출력

If Roberta can get the ball from the tee to the hole, without passing the hole, print Roberta wins in n strokes. where $n$ is minimized. If Roberta cannot get the ball from the tee to the hole, print Roberta acknowledges defeat..

제한

예제 입력 1

100
3
33
66
1

예제 출력 1

Roberta wins in 3 strokes.

힌트

출처

Olympiad > Canadian Computing Competition & Olympiad > 2000 > CCC 2000 Senior Division 4번

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

출처

대학교 대회

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

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