0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-23 20:28:48 +00:00

T258478 [Aya Round 1 A] 幻想乡扑克游戏

https://www.luogu.com.cn/record/82790224
This commit is contained in:
Baoshuo Ren 2022-08-07 14:07:16 +08:00
parent 7b46d073f1
commit bba92de9e1
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A

46
Luogu/T258478/T258478.cpp Normal file
View File

@ -0,0 +1,46 @@
#include <iostream>
#include <algorithm>
#include <string>
using std::cin;
using std::cout;
const char endl = '\n';
int t;
std::string s;
int main() {
std::ios::sync_with_stdio(false);
cin.tie(nullptr);
cin >> t;
while (t--) {
bool flag = false;
cin >> s;
std::sort(s.begin(), s.end());
if (s.find('X') != std::string::npos && s.find('D') != std::string::npos) {
flag = true;
}
int cnt = 1;
char lst = s[0];
for (int i = 1; i < s.size(); lst = s[i++]) {
if (s[i] == lst) {
cnt++;
} else {
if (cnt == 4) flag = true;
cnt = 1;
}
}
if (cnt == 4) flag = true;
cout << (flag ? "Yes" : "No") << endl;
}
return 0;
}