You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
537 B
27 lines
537 B
#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;
|
|
}
|