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

6220번 - Making Change 다국어

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

문제

Poor Bessie has taken a job in the convenience store located just over the border in Slobbovia. Slobbovians use different coinages than the USA; their coin values change day-by-day!

Help Bessie make optimal change for Slobbovian shoppers. You will need to create C (1 <= C <= 1000) cents of change using N (1 <= N <= 10) coins of various values. All test cases will be solvable using the supplied coins.

If 5 coins of values 50, 25, 10, 5, and 1 were available, Bessie would make optimum change (minimal coins) of 93 cents by using 1 x 50, 1 x 25, 1 x 10, 1 x 5, and 3 x 1 coins (a total of 7 coins).

How hard could it be? The final two test cases will be challenging.

입력

  • Line 1: Two space-separate integers: C and N
  • Lines 2..N+1: Each line contains a single unique integer that is a coin value that can be used to create change

출력

  • Line 1: A single integer that is the minimum number of coins to create C cents

제한

예제 입력 1

93 5
25
50
10
1
5

예제 출력 1

7

힌트

출처

Olympiad > USA Computing Olympiad > 2006-2007 Season > USACO January 2007 Contest > Bronze 2번

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

출처

대학교 대회

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

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