社区讨论
为什么只有10pts?
P3912素数个数参与者 1已保存回复 1
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 1 条
- 当前快照
- 1 份
- 快照标识符
- @mjpcwjcg
- 此快照首次捕获于
- 2025/12/28 14:36 2 个月前
- 此快照最后确认于
- 2025/12/28 14:39 2 个月前
CPP
#include<bits/stdc++.h>
#define int unsigned long long
using namespace std;、
bool st[100000005];
void init(int n){//埃氏筛
for(int i=2;i*i<=n;i++)
if(st[i]==0)
for(int j=i*i;j<=n;j+=i)
st[i]=1;
}
signed main(){
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int n,s=0;
cin>>n;
init(n);
for(int i=2;i<=n;i++)//统计
if(st[i]==0)
s++;
cout<<s;
return 0;}
回复
共 1 条回复,欢迎继续交流。
正在加载回复...