Files
python/TangDou/ShuLun/SL3.cpp
HuangHai 1f397eca87 'commit'
2025-08-30 18:35:01 +08:00

27 lines
537 B
C++

#include <bits/stdc++.h>
using namespace std;
bool isPrime(int n) {
if (n <= 1) return false;
for (int i = 2; i <= n / i; i++)
if (n % i == 0) return false;
return true;
}
bool Ischun_Prime(int n) {
int count = 0;
for (int i = 4; i >= 1; i--) {
n %= (int) pow(10, i);
if (isPrime(n)) count++;
}
if (count == 4) return true;
return false;
}
int main() {
for (int i = 2; i < 100; i++)
if (Ischun_Prime(i)) cout << i << endl;
return 0;
}