
ZOJ Problem Set  3044
AAA is potty about playing cards and gongzhu is one of his favorites. One day, he was playing gongzhu with his friends at home. suddenly, one of AAA's friends asked him: "do you always give the right score for everbody in the end of the round?" AAA said: "er...I can figure out the score for you soon, but it's really a hard problem for me to tell you whether the score is right..." AAA was so depressed because he couldn't solve such a problem in one of his favorite games! So now he turns to you, an execellent programmer, for help.To help you understand the rule of the game, AAA show the details below: Gongzhu is played by 4 players and every player will get some points after each round(a round means each time the players give out all the cards in their hands), the winner is the one with the highest points. 1. To play the game we need a standard deck of 52 cards (A, 2, 3, 4, 5, 6, 7, 8, 9, 10, J, Q, K of Clubs, Diamonds, Hearts and Spades). 2. We have some special cards:
3. We have some cards with points:
4. We also have a special rule called "sell":
5. What is worse, you may get a punish if you get one special card that you sell at the beginning:
6. Full_Red: If a player gets all the Hearts in a game, these 13 cards turn to 200 points if Heart A is not sold, and 400 points if Heart A is sold. If we get a full_red, we may ignore all the 15 rules about the cards in suit "Heart"(that means the special cards except Heart A will still be considered). 7. Full_All: If a player gets all the cards with points in a game, then he gets 800 points. If we get a full_red, we may ignore all the 16 rules. Input The first line of input is the number of test cases T, then T lines follow, each is a test case with two positive integers n(the n cards only contain the special cards and the cards in suit "heart") and p(the points AAA calculates).We can assume that 0 <= n <= 16 in each case. Output For each case, output a "yes" in a single line if the points AAA calculates might be right, and a "no" in a single line if it is impossible. Sample Input 2 2 30 1 150 Sample Output yes no Author: HE, Xing Source: ZOJ Monthly, September 2008 