文档章节

7_12_2013 G: Mahjong problem

電泡泡
 電泡泡
发布于 2013/07/19 18:12
字数 634
阅读 16
收藏 0

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!


© 著作权归作者所有

共有 人打赏支持
電泡泡
粉丝 23
博文 183
码字总数 69717
作品 0
衡阳
私信 提问
AppleScript 判断按键事件的脚本文章收集

AppleScript support for SplitPanes 来自:http://code.google.com/p/iterm2/issues/detail?id=559 Reported by samantha...@gmail.com , Jan 29, 2011 Hi, I would like to be able to sc......

FreeBlues
2013/12/17
0
0
时间戳转换 时间函数time(); date();

必需。规定输出日期字符串的格式。可使用下列字符: d - 一个月中的第几天(从 01 到 31) D - 星期几的文本表示(用三个字母表示) j - 一个月中的第几天,不带前导零(1 到 31) l('L' 的...

阿锋zxf
2018/06/27
0
0
关于C3p0Plugin连接SQL2000

@JFinal 你好,想跟你请教个问题:波哥,我用原生态连接SQL2000数据正常的,为啥用C3p0Plugin插件出现一下错误的! Starting JFinal 1.5 Starting scanner at interval of 5 seconds. Start...

南客
2013/12/17
971
3
STM32F4串口打印 while函数出错

总结:写while函数等类型的循环要添加“{ }”,不然不知道会出什么错误。 原函数: void division_func(void) { char *p=NULL; int i =0; //如USART1接收到的字符串:2013-12-14 //以‘-’分...

虎皮喵的喵
2018/01/18
0
0
eclipse无法启动 An error has occurred. See the log file

换了新的空间也不行 同事发个他自己有的都不行 !SESSION 2013-12-13 14:24:34.531 ----------------------------------------------- eclipse.buildId=4.3.0.I20130605-2000 java.version=1......

浅浅_online
2013/12/13
2.2K
1

没有更多内容

加载失败,请刷新页面

加载更多

四、RabbitMQ3.7在CentOS7下的安装

安装依赖 sudo yum install -y gcc gcc-c++ glibc-devel make ncurses-devel openssl-devel autoconf java-1.8.0-openjdk-devel git 创建yum源 vi /etc/yum.repos.d/rabbitmq-erlang.repo [......

XuePeng77
今天
2
0
android 延长Toast的时长

示例:myToast(5000,"hello"); public void myToast(int showTime, String msg) { Toast hello = Toast.makeText(getActivity(), msg, Toast.LENGTH_SHORT); new CountDownTimer(......

雨焰
昨天
4
0
浅谈mybatis的日志适配模式

Java开发中经常用到的日志框架有很多,Log4j、Log4j2、slf4j等等,Mybatis定义了一套统一的日志接口供上层使用,并为上述常用的日志框架提供了相应的适配器。有关适配器模式例子可以参考 设计...

算法之名
昨天
13
0
大数据教程(13.6)sqoop使用教程

上一章节,介绍了sqoop数据迁移工具安装以及简单导入实例的相关知识;本篇博客,博主将继续为小伙伴们分享sqoop的使用。 一、sqoop数据导入 (1)、导入关系表到HIVE ./sqoop import --connect...

em_aaron
昨天
3
0
Git cherry-pick 使用总结

应用背景:假设现在有两个分支:dev_01, dev_02. 如果我想把dev_01分支上的某几个commit合并到dev_02分支, 那么怎么办呢? 这就是cherry-pick的工作了。cherry-pick会捡选某些commit, 即把某...

天王盖地虎626
昨天
9
0

没有更多内容

加载失败,请刷新页面

加载更多

返回顶部
顶部