#include <iostream> using namespace std; int main() { int num; cin >> num; // 分解各位数字 int hundred = num / 100; // 获取百位 int ten = (num / 10) % 10; // 获取十位 int unit = num % 10; // 获取个位 // 判断是否对称(只需比较百位和个位) if (hundred == unit) { cout << "Y"; } else { cout << "N"; } return 0; } /************************************************************** Problem: 1628 User: linmiaoling Language: C++ Result: Accepted Time:7 ms Memory:2072 kb ****************************************************************/