1779 Teacher's assignment
Description
Soy's teachers always challenge him with hard problems. But Soy is so lazy that he is scared of dealing with hard problems. Now his teacher assigned him a new task, calculating 24. Given 4 integers a,b,c,d, he is asked whether can the numbers formed a expression equal to 24. He can only use "+","-","*","/","(",")" to make the expression. Changing the order of the numbers is also allowed. Knowing that you are good at programming ,now he is hoping for your help.
Input
There are multiple cases. The first line contains an integer T indicating the number of test cases. The next T lines, each line contains four numbers a,b,c,d. (1<= a,b,c,d <= 1000);
Output
If Soy can get a solution, print "Yes" without quotation. Otherwise print "No" without quotation.
Sample
Input
4
1 5 5 5
2 3 1 4
1 1 1 1
120 5 2 1
Output
Yes
Yes
No
Yes
Hint
One solution for the first case: (5-(1/5))*5 == 24
Source: ziki
Comments