题解
2025-04-24 22:06:32
发布于:广东
1阅读
0回复
0点赞
#include<bits/stdc++.h>
using namespace std;
// 完成回文数判定 is_pal 函数
int is_pal(char a[10001]){
string s="";
int n = strlen(a);
for(int i=n-1;i>=0;i--)s+=a[i];
if(s==a) return 1;
else return 0;
}
bool h(int n){
bool m;
if(n%4==0&&n%100!=0||n%400==0)return true;
else return 0;
}
int main() {
int n,x1=0;
cin >> n;
int m=n,i1=0;
char x[10001];
while(m){
x[i1++]=m%10+'0';
m/=10;
}
if(is_pal(x)&&h(n)) cout << "Yes" << endl;
else cout << "No" << endl;
return 0;
}
这里空空如也
有帮助,赞一个