diff --git a/1606_sushugeshu/本题(1606『入门』(代码基础)素数的个数(增强))程序同此.lnk b/1606_sushugeshu/本题(1606『入门』(代码基础)素数的个数(增强))程序同此.lnk new file mode 100644 index 0000000..63b4737 Binary files /dev/null and b/1606_sushugeshu/本题(1606『入门』(代码基础)素数的个数(增强))程序同此.lnk differ diff --git a/3069_includesushu/main.exe b/3069_includesushu/main.exe index a579ced..d17cf37 100644 Binary files a/3069_includesushu/main.exe and b/3069_includesushu/main.exe differ diff --git a/3069_includesushu/new4.24(ture).cpp b/3069_includesushu/new4.24(ture).cpp new file mode 100644 index 0000000..815fa6c --- /dev/null +++ b/3069_includesushu/new4.24(ture).cpp @@ -0,0 +1,45 @@ +#include +#include +#include +using namespace std; +bool pan[10000001] = { 0 }; +int su[100001] = { 0 }; +bool zhi[100001] = { 0 }; +int main() +{ + int begn, ends; + int now = 0; + cin >> begn >> ends; + if(begn<2){ + begn=2; + } + //cout << begn << ";" << ends << endl; + int len = sqrt(ends); + for (int i = 2; i <= len; i++) { + //cout << i << "/"; + if (zhi[i] == 0) { + su[++now] = i; + } + for (int j = 1; j <= now && i * su[j]<= len; j++) { + zhi[i * su[j]] = 1; + if (i % su[j] == 0) { + break; + } + } + } + for (int u = 1; u <= now; u++) { + int i = su[u]; + //cout << i << " "; + for (int j = ends / i; i * j >= begn && j != 1; j--) { + pan[i * j - begn] = 1; + } + } + int ans = 0; + for (int i = 0; i <= ends - begn; i++) { + if (pan[i] == 0) { + ans++; + //cout< -#include -using namespace std; -bool pan[1000001]={0}; -int main() -{ - int begn, ends; - cin >> begn >> ends; - for (int i = 2; i * i <= ends; i++) { - for(int j=ends/i;i*j>=begn&&j!=1;j--){ - pan[i*j-begn]=1; - } - } - int ans=0; - for(int i=0;i<=ends-begn;i++){ - if(pan[i]==0){ - ans++; - //cout<