高精度 题解 100% AC
2025-08-11 22:25:37
发布于:江苏
7阅读
0回复
0点赞
#include <bits/stdc++.h>
using namespace std;
stack<char> s;
string a;
int main() {
cin >> a;
for (int i = 0; i <= a.length() / 2 - 1; i++) {
s.push(a[i]);
}
int k;
if (a.length() % 2 == 0) {
k = a.length() / 2;
} else {
k = a.length() / 2 + 1;
}
for (int i = k; i < a.length(); i++) {
if (a[i] == s.top()) {
s.pop();
} else {
cout << "No";
return 0;
}
}
if (s.empty()) {
cout << "Yes";
} else {
cout << "No";
}
return 0;
}
这里空空如也
有帮助,赞一个