SSY and JLBD
生活随笔
收集整理的這篇文章主要介紹了
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 DEBUGfreopen("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 DEBUGprintf("Time cost : %lf s\n",(double)clock()/CLOCKS_PER_SEC); #endif//cout << "Hello world!" << endl;return 0; }總結
以上是生活随笔為你收集整理的SSY and JLBD的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Hello XTCPC
- 下一篇: Can you raed it cror