题解 | #回文对称数#
回文对称数
https://www.nowcoder.com/practice/5b143af8328f4e42adf5e10397ae44ef
#include <iostream>
using namespace std;
int main() {
int n;
cin>>n;
for(int i=1;i<=n;i++){
int a[8];
int j=0;
int z=i;
int temp=0;
while(z!=0){
a[j]=z%10;
z=z/10;
j++;
}
j--;
for(int x=0;x<=j/2;x++){
if(a[x]!=a[j--])temp=1;
}
if(temp==0)cout<<i<<"\n";
}
return 0;
}
// 64 位输出请用 printf("%lld")