Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
115634 | 张智博 | 31回文字符串II | C++ | Wrong Answer | 1 MS | 276 KB | 643 | 2025-04-01 21:26:30 |
#include <iostream> #include <string> using namespace std; bool isPalindrome(const string &s, int start, int end) { while (start < end) { if (s[start] != s[end]) { return false; } start++; end--; } return true; } int main() { string s; cin >> s; int n = s.length(); for (int i = 0; i < n; ++i) { for (int j = i + 1; j < n; ++j) { if (isPalindrome(s, i, j)) { cout << "Yes" << endl; return 0; } } } cout << "No" << endl; return 0; }
------Input------
aa
------Answer-----
No
------Your output-----
Yes