mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-12-24 17:51:58 +00:00
T258478 [Aya Round 1 A] 幻想乡扑克游戏
https://www.luogu.com.cn/record/82790224
This commit is contained in:
parent
7b46d073f1
commit
bba92de9e1
46
Luogu/T258478/T258478.cpp
Normal file
46
Luogu/T258478/T258478.cpp
Normal 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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user