HDU6542 SSY and JLBD 2019CCPC湖南全国邀请赛(广东省赛、江苏省赛)重现赛

题意:给你14张牌,让你判断是否为两种特殊胡牌并输出结果

           1.十三幺:东,南,西,北,红中,白板,发财,一条,九条,一万,九万,一筒,九筒,若这十三张3牌你都有,那就随便胡其中一个(只能胡这十三种任何一个,其他不行)

           2.九莲宝灯:在万、筒、条中的某一种以1112345678999的形式加上1到9其中任意一张成立,必须是门前清的状态。也称作“九连宝灯”。

分析:思考下这两种胡牌状态

           十三幺:万  筒  条  至少需要  1,9  为六张,东,南,西,北,红中,白板,发财,  为七张  ,剩下为其中一张

                          可记录一下这些牌的个数,如果都大于等于1,且总和为14即可。

           同样九莲宝灯:  万筒条三种,可记录每种出现的次数,而且记录下每种里面每个牌的个数。

                                      只要总次数为14并且有三个以上的1 三个以上的9 中间2345678大于等于1就可以。

           else   不知道

           模拟一下就可以

#include<bits/stdc++.h>
using namespace std;
const int maxn=20;
struct A{
  int aa;
  char bb;
}AC[maxn];
map<string,int>WA;
int s[20];
int p[20];
int w[20];
int ans;
int ans1,ans2,ans3;
int main()
{
  int n;
  ans=ans1=ans2=ans3=0;
  for(int i=1;i<=14;i++)
  {
     string a;
     cin>>a;
     if(a[1]=='s'||a[1]=='p'||a[1]=='w')
     {
        AC[i].aa=a[0]-'0';
        AC[i].bb=a[1];
        if(a[1]=='s')
          s[a[0]-'0']++,ans++,ans1++;
        if(a[1]=='p')
          p[a[0]-'0']++,ans++,ans2++;
        if(a[1]=='w')
          w[a[0]-'0']++,ans++,ans3++;
        //cout<<ans3<<endl;
        //cout<<AC[i].aa<<" "<<AC[i].bb<<endl;
        //cout<<a[0]<<" "<<a[1]<<" "<<a<<endl;
     }
     else
     {
        WA[string(a)]++;
        ans++;
        //cout<<WA[string(a)]<<endl;
     }
  }
  int flag=0;
  if(ans==14&&s[1]>=1&&s[9]>=1&&p[1]>=1&&p[9]>=1&&w[1]>=1&&w[9]>=1&&WA["dong"]>=1&&WA["nan"]>=1&&WA["xi"]>=1&&WA["bei"]>=1&&WA["zhong"]>=1&&WA["fa"]>=1&&WA["bai"]>=1)
    cout<<"shisanyao!"<<endl;
  else
     if(ans1==14&&s[1]>=3&&s[9]>=3&&s[2]>=1&&s[3]>=1&&s[4]>=1&&s[5]>=1&&s[6]>=1&&s[7]>=1&&s[8]>=1)
       cout<<"jiulianbaodeng!"<<endl;
  else
     if(ans2==14&&p[1]>=3&&p[9]>=3&&p[2]>=1&&p[3]>=1&&p[4]>=1&&p[5]>=1&&p[6]>=1&&p[7]>=1&&p[8]>=1)
       cout<<"jiulianbaodeng!"<<endl;
  else
     if(ans3==14&&w[1]>=3&&w[9]>=3&&w[2]>=1&&w[3]>=1&&w[4]>=1&&w[5]>=1&&w[6]>=1&&w[7]>=1&&w[8]>=1)
       cout<<"jiulianbaodeng!"<<endl;
  else
       cout<<"I dont know!"<<endl;
  //for(int i=1;i<=9;i++)
    //    cout<<w[i]<<" ";
  return 0;
}

SSY and JLBD

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 527    Accepted Submission(s): 240


 

Problem Description

Mahjong is a board game with a long history. But Mahjong has different rules in different city.

A deck of mahjong consists of 136 cards. It contains 1-9 card in three suits,and Seven kinds of word card("dong","nan","xi","bei",“zhong”,"fa","bai"),there are 4 same cards for each kind of card in a deck of mahjong .

In a mysterious country, the rules of mahjong are very simple.In the game,each Player has 14 cards.There are only two ways people can win the game:



1. shisanyao:You should have all 1 and 9 card in three suits and seven kinds of word card at the same time,and an extra card with any kind of 1 and 9 or word.

2. jiulianbaodeng:Firstly,You should make sure that you have the same suit in your hand.Secondly, for card "1" and card "9",you should have at least three . but for card "2" to card "8",at least one.For example, both "11112345678999" and "11122345678999" can win the game.



Now you know a player's 14 cards. Please judge which card type he can use to win the game.

 

 

Input

The input file contains 14 lines.Each line has a string representing a card.

For three suits of card "1" to card "9",We use two characters for the type,the first character a is number 1 to 9,and the second character b represents the suit.(a∈{1,2,3,4,5,6,7,8,9},b∈{s,p,w})

For the word cards,as shown in the description,we use full spelling pinyin represent them.

 

 

Output

If player ‘s card meet the “shisanyao” condition, you should output "shisanyao!".

If player ‘s card meet the “jiulianbaodeng” condition, you should output "jiulianbaodeng!".

Otherwise,you should output "I dont know!".

 

 

Sample Input


 

1w 5w 2w 6w 5w 9w 9w 7w 1w 3w 9w 4w 1w 8w

 

 

Sample Output


 

jiulianbaodeng!

 

 

上一篇:R语言知识


下一篇:2019浙师大校赛(浙大命题)(upc复现赛)总结