2 条题解
- 
  0
幻♂想♂乡 (njnu19180319) LV 8 @ 2019-10-17 18:30:27
#include<iostream> #define Yes 1 #define No -1 using namespace std; class Array { private: int n; int size; int *a; public: Array(int set_n) { n=set_n; size=n*2; a=new int[size]; } void set_array(int x) { int flag=0; while(x>=1) { a[flag]=x%10;//因为是判断回文数,所以输入顺序无所谓 x=x/10; flag++; } } int judge() { int flag=(n-2)/2;//要比到的中间一个数的下标 if(n==1) return Yes; for(int i=0;i<=flag;i++) { if(a[i]!=a[n-i-1]) return No; } return Yes; } }; int main() { int x; int len=0; cin>>x; int tmp=x; while(tmp>0) { len++; tmp=tmp/10; }//len为数字长度 Array arr(len); arr.set_array(x); if(arr.judge()==Yes) cout<<"Yes"<<endl; else cout<<"No"<<endl; system("pause"); return 0; } - 
  -1@ 2021-01-25 15:58:56
#include <iostream>
using namespace std;
int main()
{
int x;
cin>>x;
int x1,y=0;for (int xx=x; xx>0; xx=xx/10)
{
x1=xx%10;
y=y*10+x1;
}
if(x==y)
{
cout<<"Yes";
}
else
{
cout<<"No";
}return 0;
} 
- 1
 
信息
- 难度
 - 6
 - 分类
 - (无)
 - 标签
 - 递交数
 - 3333
 - 已通过
 - 949
 - 通过率
 - 28%
 - 被复制
 - 10
 - 上传者