| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 163767 | 汪明轩 | 寻找绝对素数 | C++ | Accepted | 29 MS | 272 KB | 756 | 2026-10-30 19:54:19 |
#include<bits/stdc++.h> using namespace std; bool isPrime(int x) { if(x < 2) return false; for(int i = 2; i <= sqrt(x); i++) { if(x % i == 0) return false; } return true; } int reverseNum(int x) { int res = 0; while(x > 0) { res = res * 10 + x % 10; x = x / 10; } return res; } int main() { int M, N; cin >> M >> N; bool first = true; for(int p = M; p <= N; p++) { if(isPrime(p) && isPrime(reverseNum(p))) { if(!first) cout << ","; cout << p; first = false; } } if(first) { cout << "No"; } return 0; }