解题思路:
都在代码里!!!!
注意事项:
参考代码:
#include <cstdio> #include <cstdlib> #include <iostream> #include <cmath> #include <cctype> #include <cstring> #include <string> #include <stack> #include <algorithm> #include <functional> using namespace std; int isprime(int n) //判读素数 { if( n < 2) { return 0; } for(int i = 2; i <= floor(sqrt(n)+0.5); ++i) { if(n%i == 0) { return 0; } } return 1; } int ishwen(int n) //判断回文 { int m = n, num = 0; while(m) { num = num*10 + m%10; m /= 10; } return n == num; } int main() { int a, b; scanf("%d%d", &a, &b); for(int i = a; i <= b; ++i) { if(isprime(i) && ishwen(i)) { printf("%d\n", i); } } return 0; }
0.0分
1 人评分
C语言程序设计教程(第三版)课后习题10.2 (C语言代码)浏览:669 |
C二级辅导-统计字符 (C语言代码)浏览:502 |
C语言训练-求矩阵的两对角线上的元素之和 (C语言代码)浏览:598 |
A+B for Input-Output Practice (C++代码)浏览:605 |
分糖果 (C++代码)浏览:1438 |
输出正反三角形 (C语言代码)格式错误!!!浏览:1140 |
淘淘的名单 (C语言代码)浏览:1090 |
IP判断 (C语言描述,蓝桥杯)浏览:1094 |
1126题解浏览:578 |
字符逆序 (C语言代码)浏览:504 |
一条咸鱼 2020-02-27 11:30:12 |
感觉应该是写题解的时候,忘记点c++了吧