ZOJ3671: Japanese Mahjong III

Source: Internet
Author: User

MahjongIs a game of skill, strategy and calculation and involves a certain degree of chance. In this problem, we concentrate onJapanese Mahjong, A variation of mahjong. For brief, all of the wordMahjongMentioned following referJapanese Mahjong.

Japanese mahjong is usually played with 136 tiles, which can be Z done? Http://www.bkjia.com/kf/ware/vc/ "target =" _ blank "class =" keylink "> v1_hbml6zwqgaw50bybzzxzlcmfsignhdgvnb3jpzxm6pc9wpgo8dww + Signature =" http://www.2cto.com/uploadfile/Collfiles/20140513/20140513090814317.jpg "alt =" \ ">BambooSuit
TheCharacterSuit
Honor tiles. Honor Tiles are tiles that do not have a rank or suit. they are divided into two categories. there are four types of Wind tiles and three types of Dragon tiles, with four of each type of honor tile. thus, there are 16 wind tiles and 12 Dragon tiles for 28 honor tiles.WindTiles. The Wind tiles consist of four kinds of tile:East,South,West, AndNorth.
DragonTiles. The Dragon titles consist of three types of tile:Red,Green,White.

In this problem, we introduce two abnormal kindsWinning handDifferent from the normalWinning hand, Which consist of four melds and one eyes.

    Seven Pairs: The hand consists of seven different pairs. No two pairs are the same. For example: Thirteen Orphans: The hand consists of thirteen kinds of tiles: Circle One, Circle Nine, Bamboo One, Bamboo Nine, Character One, Character Nine, East, South, West, North, Red, GreenAnd White.Only one kind of them are two tiles, while the others are all only one tile. For example:

    Now, givenHandWith 14 tiles, can you answer this hand is which kind of abnormal kindWinning hand?

    Input

    There are multiple cases. Each case consists of 28 characters in one line, describing 14 tiles. The manner for describing each type of tile is:

      Two characters stand for one tile. Suited tiles, The first is a integer ranged from one to nine, the tile "s rank, and the second is a character: 'P'For CircleSuit, 'S'For BambooSuit, and 'M'For CharacterSuit. Honor tiles, The first is a integer: from one to seven stands East, South, West, North, White, Green, And RedRespectively. The second one is always 'Z'. We promise that the input is a legal hand, which means there isn' t another type of tiles described above or there are more than four same tiles. Output

      For each case, if the hand isSeven Pairs, Output "Seven Pairs". If the hand isThirteen Orphans, Output "Thirteen Orphans". If the hand is neitherSeven PairsNorThirteen Orphans, Output "Neither! ".

      Sample Input
      1z1z2z2z3z3z4z4z5z5z6z6z7z7z1s9s1m9m1p9p1z2z3z4z5z6z7z7z1s9s1m9m1p9p1z2z3z4z5z6z7z7p
      Sample Output
      Seven PairsThirteen OrphansNeither!




      Determine whether it is a 7-to-13 pair or a 13-to-13 pair. The 7-to-7 pair must be different.


      #include 
         
          #include 
          
           #include 
           
            #include using namespace std;int a[4][10],len;char str[50];int main(){    int i,j,flag;    while(~scanf("%s",str))    {        len = strlen(str);        memset(a,0,sizeof(a));        for(i = 0; i
            
             

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.