文件名称:huawei--poker-game-test
-
所属分类:
- 标签属性:
- 上传时间:2012-11-16
-
文件大小:782byte
-
已下载:0次
-
提 供 者:
-
相关连接:无下载说明:别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容来自于网络,使用问题请自行百度
大家都玩过扑克,在出牌过程中大家都必须遵守一定的规则,例如顺子要5张连续的牌才能出,姐妹对要超过3对才能出等等。
现在要实现一个函数,对要出的牌进行判断,是否符合下述规则:
1. 出一张牌可以任意,例如5(5一张),返回类型1
2. 出两张牌必须是一对,例如8,8(8一对),返回类型2
3. 出三张牌必须是三张一样,例如9,9,9(三个9),返回类型3
4. 出四张牌必须是四张一样,例如11,11,11,11(J炸弹),返回类型4
5. 出顺子必须是5张牌以上,例如5,7,6,4,8,9,3(顺子),返回类型5。A可以和2或者K一起组成顺子,比如A,1,2,3,4和10,J,Q,K,A均为合法顺子。
6. 出姐妹对必须3对以上,例如5,5,6,6,7,7(姐妹对),返回类型6
7. 其余情况一律认为是非法规则,返回类型0
-We all played poker in the licensing process we all must abide by certain rules, such as straight to five consecutive cards to out to more than three pairs of sisters to a and so on.
Now to achieve a function of the license to the judge, whether the following rules:
1. The card can be arbitrary, for example, 5 (5 a), return type 1
2. The two cards are a must, for example, 8,8 (8 pair), return type 2
3. Three out of three cards must be the same, such as 9,9,9 (three 9), return type 3
4. Four out of four cards must be the same as, for example, 11,11,11,11 (J bomb), return type 4
5. Must be straight out of more than 5 cards, such as 5,7,6,4,8,9,3 (straight), return type 5. A 2 or K can be formed with straight, such as A, 1,2,3,4 and 10, J, Q, K, A are legitimate straight.
6. The sisters have three pairs of these, such as 5,5,6,6,7,7 (sister of), return type 6
7. The remaining cases all that is illegal rule, the return type 0
现在要实现一个函数,对要出的牌进行判断,是否符合下述规则:
1. 出一张牌可以任意,例如5(5一张),返回类型1
2. 出两张牌必须是一对,例如8,8(8一对),返回类型2
3. 出三张牌必须是三张一样,例如9,9,9(三个9),返回类型3
4. 出四张牌必须是四张一样,例如11,11,11,11(J炸弹),返回类型4
5. 出顺子必须是5张牌以上,例如5,7,6,4,8,9,3(顺子),返回类型5。A可以和2或者K一起组成顺子,比如A,1,2,3,4和10,J,Q,K,A均为合法顺子。
6. 出姐妹对必须3对以上,例如5,5,6,6,7,7(姐妹对),返回类型6
7. 其余情况一律认为是非法规则,返回类型0
-We all played poker in the licensing process we all must abide by certain rules, such as straight to five consecutive cards to out to more than three pairs of sisters to a and so on.
Now to achieve a function of the license to the judge, whether the following rules:
1. The card can be arbitrary, for example, 5 (5 a), return type 1
2. The two cards are a must, for example, 8,8 (8 pair), return type 2
3. Three out of three cards must be the same, such as 9,9,9 (three 9), return type 3
4. Four out of four cards must be the same as, for example, 11,11,11,11 (J bomb), return type 4
5. Must be straight out of more than 5 cards, such as 5,7,6,4,8,9,3 (straight), return type 5. A 2 or K can be formed with straight, such as A, 1,2,3,4 and 10, J, Q, K, A are legitimate straight.
6. The sisters have three pairs of these, such as 5,5,6,6,7,7 (sister of), return type 6
7. The remaining cases all that is illegal rule, the return type 0
(系统自动生成,下载前可以参看下载内容)
下载文件列表
华为机考--扑克游戏牌规则判断/扑克游戏牌规则判断.txt
华为机考--扑克游戏牌规则判断
华为机考--扑克游戏牌规则判断
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.