The Point gametime limit:ms | Memory limit:65535 KB Difficulty:5
-
- Describe
-
-
there is a game which is called 24 Point game.
in this game, you'll be given some Numbers. Your task is to find a expression which the given numbers and the value of the expression should be 24. The expression mustn ' t has any other operator except Plus,minus,multiply,divide and the brackets.
e.g. If the numbers you were given is "3 3 8 8", you can give "8/(3-8/3) "As an answer." All the numbers should is used and the bracktes can be nested.
your task in this problem are only to judge whether the given numbers can being used to find a expression whose value is the Given number.
-
- Input
-
The input has multicases and each case contains one line the first line of the input is an
- non-negative integer C (c< ; =100), which indicates the number of the cases. Each line have some integers,the first integer M (0<=m<=5) is the total number of the given numbers to consist the EXP ression,the second integers N (0<=n<=100) is the number which the value of the expression should be. Then,the followed M integer is the given numbers. All the given numbers are non-negative
and less than
-
- Output
-
For each
- test-cases,output ' Yes ' if there is a expression which fit all the demands,otherwise output "No" instead.
-
- Sample input
-
-
24 24 3 3 8 83 24 8 3 3
-
- Sample output
-
-
YesNo
Nyoj Point Game