提交时间:2026-05-15 15:38:23

运行 ID: 88757

#include <iostream> #include <string> #include <algorithm> using namespace std; bool isPalindrome(int x) { string s = to_string(x); string rev = s; reverse(rev.begin(), rev.end()); return s == rev; } int main() { for (int n = 1; n <= 256; ++n) { int square = n * n; if (isPalindrome(square)) { cout << n << endl; } } return 0; }