7_12_2013 G: Mahjong problem

Problem G: Mahjong problem

Time Limit: 1 Sec   Memory Limit: 128 MB
Submit: 0   Solved: 0
[ Submit][ Status][ Web Board]

Description

In Chinese, Mahjong is the mean of ‘MaJiang’, as we know, Dremone is very fond of mahjong, he is always 
very bored, and he wants to teach the cat of his house to play mahjong, if she can also play it, dreamone can 
play it with her happily. 
In dremone’s mahjong, there is only a single kind of Mahjong Tile which is from 1 to 9. Firstly, Dremone 
wants to describe the rules about mahjong: 
 A Pong, or Pung, is a set of three identical tiles. 
For example:1 1 1; 7 7 7;  
 A Chow is a meld of three suited tiles in sequence. 
For example: 1 2 3; 3 4 5; 4 5 6; 5 6 7;  
 An Eye is the pair; it consists of any two identical tiles. 
For example: 1 1; 2 2; 3 3; 
If you have only an Eye and many Pongs or many Chows, you will be ‘HuPai’. If you are only in the status 
of being short of a single tile, you will be called ‘Hearing Tile’. If you want to be ‘HuPai’ only if there is 2 
Mahjong tiles or 5 or 8 or 11 or 14 Mahjong tiles in your hands. So if you are not being the status of ‘HuPai’, 
there is always 1 Mahjong tiles or 4 or 7 or 10 or 13 Mahjong tiles in your hands.  
As we know, if you are in the status of ‘HuPai’, there will be no more than 4 for each kind of ‘Mahjong Tile’ 
from 1 to 9. 
What’s more, If you get the Mahjong Tiles such as : 4 4 4 4 ,According to the rules above, you have been in 
the status of ‘Hearing Tile’ ,and if you can get another 4,you will be ‘HuPai’,but it is impossible for you to 
achieve it, because of the limitation about the numbers for each Tile. So we use ‘Status A’ represented your 
status. 
Another case, if the Mahjong numbers will not be 1,4,7,10,13 before you are in the status of ‘HuPai’, we call 
the status ‘Small Xianggong’. And we use ‘Status B’ represented it. 
Of course, if you can ‘HuPai’ after you get another single tile, you should tell us which Tiles can you 
‘HuPai’.for example:  
If the tiles is described as:  1 2 3 4 .and you can ‘Hu’ 1 or 4. 
If the tiles is described as:  2 2 3 3 .and you can ‘Hu’ 2 or 3. 
If the tiles is described as:  2 2 3 3 4 4 4 .and you can ‘Hu’ 1 or 2 or 3 or 4. 
Of course, you may not ‘HuPai’ if you get any single tile, such as: 
If the tiles is described as:  1 3 4 3, or described as: 1 2 3 4 5 5 7, so you are in the status of ‘Can not 
HuPai!’ 
Can you get the main idea? 

Input

The first line of input will be a positive integer C indicating how many data sets will be included. Each of 
the C data sets will contain only a single line represented the brands .Each line will be ended with pressing 
“Enter” key. 

Output

For each case, output ‘Status A’ or ‘Status B’ or ‘Can not HuPai!’ or the tiles you can ‘HuPai’ as the order 
from small to big. 

Sample Input

6

 2 2 2 2 

 1 2 3 4

 2 4 

 1 2 3 5 6 6 5 

 1 2 3 4 5 6 

 3 4 5 1 2 4 9

Sample Output

Status A 1 4 

 Status B 5 6 

 Status B 

 Can not HuPai!


你可能感兴趣的:(7_12_2013 G: Mahjong problem)