3011. Coins (IV)

单点时限: 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.


2 5
1 2
2 10
1 2
3 10
1 3 5
Case 1: Yes
Case 2: No
Case 3: Yes

9 人解决,17 人已尝试。

11 份提交通过,共有 56 份提交。

7.0 EMB 奖励。

创建: 7 年,11 月前.

修改: 3 年,9 月前.

最后提交: 8 月,1 周前.

来源: Coins 系列