9个RE求调
查看原帖
9个RE求调
797229
inarticulate_stupid楼主2023/9/7 17:19
#include<bits/stdc++.h>
using namespace std;
const int N=1e8+5;
int n,a[N],p,d,x,s;
bool f[N];
signed main(){
    std::ios::sync_with_stdio(0);
	cin>>n;
	for(int i=2;i<=n;i++){
		if(!f[i])a[++p]=i,b[++d]=i,s++;
		for(long long j=i*i;j<=p;j++)
		{
			f[a[j]*i]=1;
			if(i%a[j]==0)break;
		}
	}
    cout<<s;
	return 0;
}
2023/9/7 17:19
加载中...