2019沈阳网选——模拟

  1 #include <bits/stdc++.h>
  2 using namespace std;
  3 
  4 struct Node{
  5     string name;
  6     int straight;
  7     pair<int,int> four;
  8     pair<int,int> full;
  9     pair<int,int> three;
 10     pair<pair<int,int>,int> twopair;
 11     pair<int,int> pairr;
 12     int handcard;
 13 }a[100005];
 14 
 15 bool cmp(Node a,Node b){
 16     if(a.straight == b.straight){
 17         if(a.four.first == b.four.first){
 18             if(a.four.second == b.four.second){
 19                 if(a.full.first == b.full.first){
 20                     if(a.full.second == b.full.second){
 21                         if(a.three.first == b.three.first){
 22                             if(a.three.second == b.three.second){
 23                                 if(a.twopair.first.first == b.twopair.first.first){
 24                                     if(a.twopair.first.second == b.twopair.first.second){
 25                                         if(a.twopair.second == b.twopair.second){
 26                                             if(a.pairr.first == b.pairr.first){
 27                                                 if(a.pairr.second == b.pairr.second){
 28                                                     if(a.handcard == b.handcard){
 29                                                         return a.name < b.name;
 30                                                     }
 31                                                     return a.handcard > b.handcard;
 32                                                 }
 33                                                 return a.pairr.second > b.pairr.second;
 34                                             }
 35                                             return a.pairr.first > b.pairr.first;
 36                                         }
 37                                         return a.twopair.second > b.twopair.second;
 38                                     }
 39                                     return a.twopair.first.second > b.twopair.first.second;
 40                                 }
 41                                 return a.twopair.first.first > b.twopair.first.first;
 42                             }
 43                             return a.three.second > b.three.second;
 44                         }
 45                         return a.three.first > b.three.first;
 46                     }
 47                     return a.full.second > b.full.second;
 48                 }
 49                 return a.full.first > b.full.first;
 50             }
 51             return a.four.second > b.four.second;
 52         }
 53         return a.four.first > b.four.first; ;
 54     }
 55     return a.straight > b.straight;
 56 }
 57 
 58 
 59 int n;
 60 int main()
 61 {
 62     while(~scanf("%d",&n)){
 63         for(int ii = 0;ii < n;ii ++){
 64             cin >> a[ii].name;
 65             a[ii].straight = -1;
 66             a[ii].four = make_pair(-1,-1);
 67             a[ii].full = make_pair(-1,-1);
 68             a[ii].three = make_pair(-1,-1);
 69             a[ii].twopair = make_pair(make_pair(-1,-1),-1);
 70             a[ii].pairr = make_pair(-1,-1);
 71             a[ii].handcard = -1;
 72             string p;cin >> p;
 73             int vis[17];
 74             memset(vis,0,sizeof(vis));
 75             for(int j = 0;j < p.size();j ++){
 76                 if(p[j] == '1'){vis[10] ++;}
 77                 if(p[j] == '0'){continue;}
 78                 if(p[j] == 'A'){vis[14] ++;vis[1] ++;}
 79                 if(p[j] == 'J'){vis[11] ++;}
 80                 if(p[j] == 'Q'){vis[12] ++;}
 81                 if(p[j] == 'K'){vis[13] ++;}
 82                 if(p[j] >= '2' && p[j] <= '9'){
 83                     vis[p[j] - '0'] ++;
 84                 }
 85             }
 86 
 87             for(int i = 1;i <= 10;i ++){///str
 88                 if(vis[i] && vis[i+1] && vis[i+2] && vis[i+3] && vis[i+4]){
 89                     a[ii].straight = i;break;
 90                 }
 91             }
 92             if(a[ii].straight != -1){continue;}
 93 
 94             for(int i = 1;i < 14;i ++){///four
 95                 if(vis[i] == 4){
 96                     a[ii].four.first = i;break;
 97                 }
 98             }
 99             for(int i = 1;i < 14;i ++){
100                 if(vis[i] == 1){
101                     a[ii].four.second = i;break;
102                 }
103             }
104             if(a[ii].four.second != -1 && a[ii].four.first != -1){continue;}
105             else{a[ii].four = make_pair(-1,-1);}
106 
107             for(int i = 1;i < 14;i ++){///full
108                 if(vis[i] == 3){
109                     a[ii].full.first = i;break;
110                 }
111             }
112             for(int i = 1;i < 14;i ++){
113                 if(vis[i] == 2){
114                     a[ii].full.second = i;break;
115                 }
116             }
117             if(a[ii].full.second == -1 || a[ii].full.first == -1){a[ii].full = make_pair(-1,-1);}
118             else{continue;}
119 
120             for(int i = 1;i < 14;i ++){///three
121                 if(vis[i] == 3){
122                     a[ii].three.first = i;break;
123                 }
124             }
125             int cnt = 0;
126             for(int i = 1;i < 14;i ++){
127                 if(vis[i] == 1){
128                     cnt += i;
129                 }
130             }
131             a[ii].three.second = cnt;
132             if(a[ii].three.second != -1 && a[ii].three.first != -1){continue;}
133             else{a[ii].three = make_pair(-1,-1);}
134 
135             cnt = 0;int sum = 0;
136             for(int i = 13;i >= 1;i --){///two p
137                 if(vis[i] == 2){
138                     if(a[ii].twopair.first.first != -1){
139                         cnt ++;a[ii].twopair.first.second = i;
140                     }
141                     else {a[ii].twopair.first.first = i;cnt ++;}
142                 }
143                 else if(vis[i] == 1){sum += i;}
144             }
145             if(cnt == 2){a[ii].twopair.second = sum;continue;}
146             else{a[ii].twopair = make_pair(make_pair(-1,-1),-1);}
147 
148             sum = 0;
149             for(int i = 13;i >= 1;i --){///pair
150                 if(vis[i] == 2){
151                     a[ii].pairr.first = i;
152                 }
153                 else if(vis[i] == 1){
154                     sum += i;
155                 }
156             }
157             if(a[ii].pairr.first != -1){a[ii].pairr.second = sum;continue;}
158             else{a[ii].pairr = make_pair(-1,-1);}
159 
160             sum = 0;
161             for(int i = 13;i >= 1;i --){///hand
162                 if(vis[i] == 1){
163                     sum += i;
164                 }
165             }
166             a[ii].handcard = sum;
167         }
168         for(int i = 0;i < n;i ++){
169             cout << a[i].name + " :" << endl;
170             cout << "str : " << a[i].straight << endl;
171             cout << "four : " << a[i].four.first << " " << a[i].four.second << endl;
172             cout << "full : " << a[i].full.first << " " << a[i].full.second << endl;
173             cout << "three : " << a[i].three.first << " " << a[i].three.second << endl;
174             cout << "twopa : " << a[i].twopair.first.first << " " << a[i].twopair.first.second << " " << a[i].twopair.second << endl;
175             cout << "pair : " << a[i].pairr.first << " " << a[i].pairr.second << endl;
176             cout << "hand : " << a[i].handcard << endl;
177         }
178         sort(a,a + n,cmp);
179         for(int i = 0;i < n;i ++){
180             cout << a[i].name << endl;
181         }
182     }
183     return 0;
184 }

 

转载于:https://www.cnblogs.com/love-fromAtoZ/p/11519576.html

下载前可以先看下教程 https://pan.quark.cn/s/16a53f4bd595 小天才电话手表刷机教程 — 基础篇 我们将为您简单的介绍小天才电话手表新机型的简单刷机以及玩法,如adb工具的使用,magisk的刷入等等。 我们会确保您看完此教程后能够对Android系统有一个最基本的认识,以及能够成功通过magisk root您的手表,并安装您需要的第三方软件。 ADB Android Debug Bridge,简称,在android developer的adb文档中是这么描述它的: 是一种多功能命令行工具,可让您与设备进行通信。 该命令有助于各种设备操作,例如安装和调试应用程序。 提供对 Unix shell 的访问,您可以使用它在设备上运行各种命令。 它是一个客户端-服务器程序。 这听起来有些难以理解,因为您也没有必要去理解它,如果您对本文中的任何关键名词产生疑惑或兴趣,您都可以在搜索引擎中去搜索它,当然,我们会对其进行简单的解释:是一款在命令行中运行的,用于对Android设备进行调试的工具,并拥有比一般用户以及程序更高的权限,所以,我们可以使用它对Android设备进行最基本的调试操作。 而在小天才电话手表上启用它,您只需要这么做: - 打开拨号盘; - 输入; - 点按打开adb调试项。 其次是电脑上的Android SDK Platform-Tools的安装,此工具是 Android SDK 的组件。 它包括与 Android 平台交互的工具,主要由和构成,如果您接触过Android开发,必然会使用到它,因为它包含在Android Studio等IDE中,当然,您可以独立下载,在下方择对应的版本即可: - Download SDK Platform...
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值