经历千辛万苦终于做出来了!
2025-09-01 19:00:03
发布于:天津
1阅读
0回复
0点赞
代码如下:
#include <bits/stdc++.h>
using namespace std;
bool f1(int n){
int s=0,t=n;
while(t){
s*=10;
s+=t%10;
t/=10;
}
if(s==n)return true;
else return false;
}
bool f2(int n){
for(int i=2;i<=n-1;i++){
if(n%i==0)return false;
}
return true;
}
int main(){
int n;
cin>>n;
if(f1(n)&&f2(n))cout<<"Yes";
else cout<<"No";
return 0;
}
这里空空如也
有帮助,赞一个