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

5350번 - Transport 다국어

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

문제

You have a transport plane that has to deliver items to a remote location. You would like to load all the items on the plane, but you can not exceed the plane’s weight capacity, W. Given n items of known weights w1, w2, …, wn and values v1, v2, …, vn find the most valuable subset of the items that fit into the plane without exceeding the capacity, W.

입력

The first line of input will be a positive integer indicating the number of problem sets. Each problem set will start with a line that has two positive integers, n and W, where n is the number of items and W is the capacity of the plane. The next n lines will have two integers, w and v, where w is the weight and v is the value of the item. All weights and values will be positive integers, and the number of items in any problem set will be no more than 20.

출력

For each problem set print, on a separate line, the total value of the most valuable subset that the plane can transport without exceeding its capacity W.

제한

예제 입력 1

2
3 5
2 3
2 2
3 3
4 10
7 42
3 12
4 40
5 25

예제 출력 1

6
65

힌트

출처

School > PLU High School Programming Contest > PLU 2013 > Advanced 8번

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

출처

대학교 대회

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

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