我就用map,毫不麻烦!if的可能会慢哦
2025-08-03 18:52:36
发布于:浙江
1阅读
0回复
0点赞
#include<unordered_map>
#include<iostream>
using namespace std;
map<string,int>poker = {{"3",0}, {"4",1}, {"5",2}, {"6",3},
{"7",4}, {"8",5}, {"9",6}, {"10",7}, {"J",8}, {"Q",9},
{"K",10}, {"A",11}, {"2",12}, {"Joker",13}};
int main() {
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
string cardA, cardB;
cin >> cardA >> cardB;
int weight_for_A = poker[cardA], weight_for_B = poker[cardB];
if (weight_for_A > weight_for_B) cout << "First" << endl;
else if (weight_for_A<weight_for_B) cout << "Second" << endl;
else cout << "Equal" << endl;
return 0;
}
这里空空如也
有帮助,赞一个