hdoj.1431 素数回文 20140724
来源:互联网 发布:战龙三国张郺进阶数据 编辑:程序博客网 时间:2024/06/05 10:19
素数回文
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 10935 Accepted Submission(s): 2551
Problem Description
xiaoou33对既是素数又是回文的数特别感兴趣。比如说151既是素数又是个回文。现在xiaoou333想要你帮助他找出某个范围内的素数回文数,请你写个程序找出 a 跟b 之间满足条件的数。(5 <= a < b <= 100,000,000);
Input
这里有许多组数据,每组包括两组数据a跟b。
Output
对每一组数据,按从小到大输出a,b之间所有满足条件的素数回文数(包括a跟b)每组数据之后空一行。
Sample Input
5 500
Sample Output
5711101131151181191313353373383#include<stdio.h>int sushu(int a){ int i,r=1; for(i=2;i*i<=a;i++){ if(a%i==0){ r=0;break; } } return r;}int huiwen(int a){ int i,j=a,x=0; while(j){ i=j%10; x=x*10+i; j/=10; } if(x==a) return 1; else return 0;}int main(){ int a,b; while(scanf("%d %d",&a,&b)!=EOF){ for(;a<=b&&a<=9989899;a++){ if(huiwen(a)&&sushu(a)) printf("%d\n",a); } printf("\n"); } return 0;}
0 0
- hdoj.1431 素数回文 20140724
- HDOJ 1431 素数回文
- hdoj 1431 素数回文
- hdoj 1431 素数回文
- hdoj 1431 素数回文
- HDOJ 1431 回文素数
- hdoj-1431-素数回文
- hdoj 素数回文 1431 (模拟)
- 素数回文——HDOJ 1431
- hdoj 1431 素数回文 【暴力打表】
- hdoj 1431 素数回文【素数筛法+回文数判断打表】
- hdoj 1431 素数回文【打表+素数筛法+回文数判断】
- HDOJ 提姆1431素数回文 (打表)
- HDOJ 1431-素数回文【删除大量无关数据】
- hdoj 素数回文 1431 (素数打表&&转换)好题
- HDU 1431 素数回文(回文素数)
- Hdu 1431 素数回文【素数+回文】
- hdu 1431 素数回文
- 第三方API的调用开发
- hibernate的简单配置
- 关于Build Active Architecture Only属性
- Android系统启动流程 -- android层
- MongoDB在CentOS 7上的systemctl服务配置
- hdoj.1431 素数回文 20140724
- faac库的编译与移植
- ASCLL码排序
- Ubuntu 和 Windows 的 PATH 变量异同
- Eclipse Python插件 PyDev
- 记录了有些比较少见、奇葩的问题和这些问题的解决方式(会不断增加)
- CSS display:none和visibility:hidden的区别
- 在Ubuntu安装ftp服务器
- 职场35岁现象:关于职业规划的文章