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

16551번 - Potato Sacks 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB1951118457.931%

문제

Potato sacks come in different weight capacities (specified in pounds). Potatoes come in different weights. If you are given some number of potatoes of possibly different weights (specified in pounds), determine if it is possible to exactly fill a potato sack of a given capacity using some or all of the potatoes.

입력

The first line of input contains a single decimal integer P, (1 ≤ P ≤ 100), which is the number of data sets that follow. Each data set should be processed identically and independently.

Each data set consists of a single line of input containing 12 space separated positive integers. They are the data set number, K, followed by the capacity, C, of the potato sack in pounds, (10 ≤ C ≤ 30), followed by the weights of 10 potatoes in pounds. A potato will not weigh more than 3 pounds.

출력

For each data set there is a single line of output.

The output line consists of the data set number, K, followed by a single space, the word YES if the potato sack can be filled exactly to capacity C pounds or the word NO if it cannot be filled exactly.

제한

예제 입력 1

2
1 20 3 2 1 3 3 2 3 2 1 1
2 25 3 3 3 3 3 3 3 3 3 3

예제 출력 1

1 YES
2 NO

힌트

출처

ICPC > Regionals > North America > Greater New York Region > 2018 Greater New York Programming Contest A번

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

출처

대학교 대회

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

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