1 条题解
-
0
先设每张牌的权值为 ,再按题意模拟即可。
AC code:
#include <bits/stdc++.h> using namespace std; unordered_map<string, int> card_value = { {"NULL", 0}, {"3", 1}, {"4", 2}, {"5", 3}, {"6", 4}, {"7", 5}, {"8", 6}, {"9", 7}, {"10", 8}, {"J", 9}, {"Q", 10}, {"K", 11}, {"A", 12}, {"2", 13}, {"LJ", 14}, {"BJ", 15} }; int main() { int n; cin >> n; vector<vector<int> > players(n); for (int i = 0; i < n; i++) { vector<int> hand(13); for (int j = 0; j < 13; j++) { string card; cin >> card; hand[j] = card_value[card]; } sort(hand.begin(), hand.end()); players[i] = hand; } int cur = 0; int top = 0; while (true) { vector<int>& hand = players[cur]; auto it = upper_bound(hand.begin(), hand.end(), top); if (it != hand.end()) { top = *it; hand.erase(it); } else { top = 0; } if (hand.empty()) { cout << cur + 1 << endl; return 0; } cur = (cur + 1) % n; } return 0; }
- 1
信息
- ID
- 145
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- 3
- 标签
- 递交数
- 5
- 已通过
- 3
- 上传者