youwu
This commit is contained in:
parent
362db2afe0
commit
eef818e5c8
@ -1,16 +1,50 @@
|
|||||||
//weiwancheng
|
//youwu
|
||||||
|
#include <cmath>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
using namespace std;
|
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 main()
|
||||||
{
|
{
|
||||||
int n,f[10001]={0};
|
int n, f[100001] = { 0 }, now = 1, next = 2;
|
||||||
cin>>n;
|
bool ans[1000001] = { 0 };
|
||||||
f[1]=2;
|
cin >> n;
|
||||||
f[2]=3;
|
|
||||||
f[3]=5;
|
int tou = 0, wei = 1;
|
||||||
f[5]=7;
|
do {
|
||||||
int tou=4,wei=5;
|
|
||||||
do{
|
|
||||||
tou++;
|
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.
@ -0,0 +1 @@
|
|||||||
|
10
|
@ -0,0 +1 @@
|
|||||||
|
100
|
@ -0,0 +1 @@
|
|||||||
|
1000000
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user