This commit is contained in:
James 2020-04-29 18:19:21 +08:00
parent 362db2afe0
commit eef818e5c8
6 changed files with 1741 additions and 14 deletions

View File

@ -1,16 +1,50 @@
//weiwancheng
//youwu
#include <cmath>
#include <iostream>
using namespace std;
bool pan(int n)
{
if (n < 2) {
return 0;
}
if (n == 2) {
return 1;
}
int len = sqrt(n);
for (int i = 2; i <= len; i++) {
if (n % i == 0) {
return 0;
}
}
return 1;
}
int main()
{
int n,f[10001]={0};
cin>>n;
f[1]=2;
f[2]=3;
f[3]=5;
f[5]=7;
int tou=4,wei=5;
do{
int n, f[100001] = { 0 }, now = 1, next = 2;
bool ans[1000001] = { 0 };
cin >> n;
int tou = 0, wei = 1;
do {
tou++;
}while(tou<wei)
if (tou == next) {
next = wei + 1;
now *= 10;
}
for (int i = 0; i < 10; i++) {
int zhe = i * now + f[tou];
if (zhe > n) {
for (int i = 10; i <= n; i++) {
if (ans[i] == 1) {
cout << i << endl;
}
}
return 0;
}
if (pan(zhe) == 1) {
f[++wei] = zhe;
ans[zhe] = 1;
}
}
} while (tou < wei);
}

Binary file not shown.

View File

@ -0,0 +1 @@
10

View File

@ -0,0 +1 @@
100

View File

@ -0,0 +1 @@
1000000

File diff suppressed because it is too large Load Diff