SSY and JLBD
http://acm.hdu.edu.cn/showproblem.php?pid=6542
题意:判断是否满足“shisanyao”或者“jiulianbaodeng”的要求
题解:只要根据题意进行简单的模拟即可,唯一略有麻烦的地方应该就是麻将牌的读入了。
C++版本一
/*
*@Author: STZG
*@Language: C++
*/
#include <bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<cstdlib>
#include<cstring>
#include<cstdio>
#include<string>
#include<vector>
#include<bitset>
#include<queue>
#include<deque>
#include<stack>
#include<cmath>
#include<list>
#include<map>
#include<set>
//#define DEBUG
#define RI register int
#define endl "\n"
using namespace std;
typedef long long ll;
//typedef __int128 lll;
const int N=100000+10;
const int M=100000+10;
const int MOD=1e9+7;
const double PI = acos(-1.0);
const double EXP = 1E-8;
const int INF = 0x3f3f3f3f;
int t,n,m,k,p,l,r,u,v;
int ans,cnt,flag,temp,sum;
int a[4][10];
int b[2][14]={{0,0,1,1,2,2,3,3,3,3,3,3,3},
{1,9,1,9,1,9,1,2,3,4,5,6,7}};
int c[10]={0,3,1,1,1,1,1,1,1,3};
string str;
string word[8]={"","dong","nan","xi","bei","zhong","fa","bai"};
struct node{};
int main()
{
#ifdef DEBUG
freopen("input.in", "r", stdin);
//freopen("output.out", "w", stdout);
#endif
//ios::sync_with_stdio(false);
//cin.tie(0);
//cout.tie(0);
//scanf("%d",&t);
//while(t--){
//scanf("%d",&n);
for(int i=1;i<=14;i++){
cin>>str;
if(isdigit(str[0])){
if(str[1]=='s'){
a[0][str[0]-'0']++;a[0][0]++;
}else if(str[1]=='p'){
a[1][str[0]-'0']++;a[1][0]++;
}else if(str[1]=='w'){
a[2][str[0]-'0']++;a[2][0]++;
}
}else{
for(int j=1;j<=7;j++){
if(str==word[j]){
a[3][j]++;a[3][0]++;
break;
}
}
}
}
flag = 1;
for(int i=0;i<13;i++)if(!a[b[0][i]][b[1][i]]){flag=0;break;}
if(flag){cout<<"shisanyao!"<<endl;return 0;}
for(int i=0;i<3;i++){
if(a[i][0]==14){
flag=1;
for(int j=1;j<=9;j++){
if(a[i][j]<c[j]){
flag=0;
}
}
if(flag){cout<<"jiulianbaodeng!"<<endl;return 0;}
}
}
cout<<"I dont know!"<<endl;
//}
#ifdef DEBUG
printf("Time cost : %lf s\n",(double)clock()/CLOCKS_PER_SEC);
#endif
//cout << "Hello world!" << endl;
return 0;
}