10 人解决,19 人已尝试。
12 份提交通过,共有 60 份提交。
6.9 EMB 奖励。
单点时限: 1.0 sec
内存限制: 256 MB
Given $n$ coins, values of them are $A_1, A_2, \ldots, A_n$ respectively, you have to find whether you can pay $K$ using the coins. You can use any coin at most two times.
Input starts with an integer $T$ ($T \le 20$), denoting the number of test cases.
Each case starts with a line containing two integers $n$ ($1 \le n \le 18$) and $K$ ($1 \le K \le 10^9$). The next line contains $n$ distinct integers denoting the values of the coins. These values will lie in the range $[1, 10^7]$.
For each case, print the case number and Yes
if you can pay $K$ using the coins, or No
if it’s not possible.
3 2 5 1 2 2 10 1 2 3 10 1 3 5
Case 1: Yes Case 2: No Case 3: Yes
10 人解决,19 人已尝试。
12 份提交通过,共有 60 份提交。
6.9 EMB 奖励。