点击这里更换您喜欢的皮肤wtboj 首页
请点击这里登入noios   首页 入门 c++讲义 入门教程视频 其他页面 入门视频 站务 公告 | 题库 记录 竞测 测试 闯关 作业 排名 团队 讨论 | 换肤 | 登入 注册  
News >>   新增功能:各团队管理员可以发布本团队作业了 ()

From VijosGuest0
螺旋弯
讨论 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
提交 讨论 题解
 Copyright wtboj © 2005-2006. www.wutuobang.date Powered by wtboj 关于 联系 帮助
 wtboj Information ---- Total Users : 1390 | Online Users / Processes : 0 / 186 | Processed Time : 47 ms | Server Time : 2026/9/10 11:58:45