RRX - Treat! Treat!

no tags 

Today is Roxy’s Birthday. So, First of all, we wish you many many happy returns of the day!!

Now, Some of his friends (Rifat, Saikat, Tumpa, Shuvo, Pushpa, Rabee, Murad and some more) want to surprise Roxy by putting a very big candle on his Birthday Cake. But unfortunately, very big candle is unavailable at shop. So Saikat made a decision to join/attach some little candles one after one for making a big candle. Nice job, isn’t it?

Now Saikat has bought some small candle of various size. Now he wants to know that after joining/attaching some of them, is it possible to make a big candle of size P? Help Saikat ! He is so worried about that.

Input:

Input starts with an integer T(1<=T<=100) denoting the number of test cases. Each test case contains one integer N(1<=N<=100) representing the number of small candles that Saikat has bought. Next line contains N integers denoting the size of the candles. Each candle size is no more than 100. Next line contains one integer P(1<=P<=20000).

Output:

For each test case, print the case number and “Yes” if it is possible to make a candle of size P, print “No” otherwise. See sample input and output for exact format.

Sample Input/Output:

Sample Input

Sample Output

3

3

1 2 3

5

2

1 4

4

3

1 2 3

7

Case 1: Yes

Case 2: Yes

Case 3: No  

Problem Setter: Md Abdul Alim, Dept. of Computer Science, Bangladesh University of Business & Technology


hide comments
nadstratosfer: 2018-10-25 21:37:48

Badly formatted testfiles with linebreaks between array elements. Python/Java solvers, use C-style "next integer" input methods instead of line-based standard.


Added by:Alim
Date:2015-11-17
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64 GOSU JS-MONKEY