社区讨论
求调喵
B4039[GESP202409 三级] 回文拼接参与者 2已保存回复 2
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 2 条
- 当前快照
- 1 份
- 快照标识符
- @mcg641bu
- 此快照首次捕获于
- 2025/06/28 19:38 8 个月前
- 此快照最后确认于
- 2025/06/29 14:11 8 个月前
CPP
#include <bits/stdc++.h>
using namespace std;
int if_huiwen(string s)
{
int k = s.size() / 2;
for (int i=0, j=s.size()-1; i<s.size(), j>=s.size()-k; i++, j--)
{
if (!(s[i] == s[j]))
return 0;
}
return 1;
}
int main()
{
int a;
cin >> a;
for (int i=1; i<=a; i++)
{
string s1;
char c;
int f=0;
while (cin >> c)
{
s1 += c;
if (if_huiwen(s1))
{
s1 = "";
f = 1;
}
}
if (f == 0)
cout << "No" << endl;
else
cout << "Yes" << endl;
}
return 0;
}
回复
共 2 条回复,欢迎继续交流。
正在加载回复...