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

6752번 - Time on task 다국어

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

문제

You have been asked by a parental unit to do your chores.

Each chore takes a certain amount of time, but you may not have enough time to do all of your chores, since you can only complete one chore at a time. You can do the chores in any order that you wish.

What is the largest amount of chores you can complete in the given amount of time?

입력

The first line of input consists of an integer T (0 ≤ T ≤ 100000), which is the total number of minutes you have available to complete your chores.

The second line of input consists of an integer C (0 ≤ C ≤ 100), which is the total number of chores that you may choose from. The next C lines contain the (positive integer) number of minutes required to do each of these chores. You can assume that each chore will take at most 100000 minutes.

출력

The output will be the maximum number of chores that can be completed in time T

제한

예제 입력 1

6
3
3
6
3

예제 출력 1

2

힌트

Chores must be completed in at most 6 minutes. There are 3 chores available. The first chore takes 3 minutes. The second chore takes 6 minutes. The third chore takes 3 minutes. The answer is 2 since only 2 of these chores can be completed in 6 minutes of time. Specifically, the first and last chore can be completed in the allowable time. It is not possible to complete all 3 chores in 6 minutes.

출처

Olympiad > Canadian Computing Competition & Olympiad > 2013 > CCC 2013 Junior Division 4번

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

출처

대학교 대회

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

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