2022牛客多校(八)
文章目录
一、比赛小结
- 2022牛客多校(八)
- 一、比赛小结
- 二、题目分析及解法(基础题)
- D、Poker Game: Decision
- F、Longest Common Subsequence
- 三、题目分析及解法(进阶题)
比赛链接:"蔚来杯"2022牛客暑期多校训练营8
二、题目分析及解法(基础题) D、Poker Game: Decision题目链接:D-Poker Game: Decision
题意:
德州扑克,两人博弈
题解:
记忆化所有答案即可,博弈部分简单,判断牌型部分难写 代码:
#include
using namespace std;
using LL = long long;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
auto read = []() {
static string ranks = "0123456789TJQKA";
static string suits = "SHCD";
string s;
cin >> s;
return (find(ranks.begin(), ranks.end(), s[0]) - ranks.begin()) * 4 +
(find(suits.begin(), suits.end(), s[1]) - suits.begin());
};
map mp;
auto rank = [&](LL h) -> int {
int res = 0;
vector r, s;
while (h) {
int t = __builtin_ctzll(h);
r.push_back(t / 4);
s.push_back(t % 4);
h ^= 1LL
关注
打赏