|
|
|
|
讨论 Discussion |
|
| |
615578991 |
#include<cmath>
#include<iostream>
int prim(int x){
int i,j,f=1;
for(i=2;i<=int(sqrt(x));i++){
if(x%i==0){f=0;break;}
}
return f;
}
int huiwen(int x){
int i=0,j,f=1,s,t,c[20]={0};
s=x;
while(s>0){i++;c[i]=s%10;s=s/10;}
for(j=1;j<=i/2;j++)if(c[j]!=c[1+i-j]){f=0;break;}
return f;
}
using namespace std;
int main(){
//freopen("p1642.in","r",stdin);
//freopen("p1642.out","w",stdout);
int i,j,k,n,s,x=0,y=0,p,t,f=0,d=0;
int a[10]={0},b[10]={0};
cin>>s; n=s;
y=n;
if (y%2==0)y++;
do{
if(prim(y)&&huiwen(y)){cout<<y;break;}
y+=2;
}while(1==1);
return 0;
}
( ) |
|
|
|
|
|
|
|
|
|
Flag |
|
题号 |
P1091 |
|
其它 |
通过 |
51人 |
提交 |
135次 |
通过率 |
38% |
难度 |
0 |
|
|
|
|
|
|