top1编程
← 返回题目
题解

【入门】三位数是否对称

1 条题解

  • 0
    @ 2026-7-29 0:16:10
    #include <bits/stdc++.h> 
    using namespace std;
    int main(){
    // 		/10  把最后一位去掉
    //		%10  只保留最后一位 
    	int n;
    	cin>>n;
    	int g=n%10;
    	int b=n/100; 
    	if(g==b){
    		cout<<"Y";
    	}
    	else{
    		cout<<"N";
    	}
    	return 0;
     
    }
    
    • 1