我帮别人测试,然后发现这题评测机是不是有点太智能了???
我prime数组都开成1e3了都能过?????还是有什么特性?
#include <iostream>
#include <cstdio>
using namespace std;
typedef long long LL;
const int N= 1e8+10;
const int M = 1e3;
LL n,cnt;
bool st[N];
int primes[M];
void get_primes(){
for(int i =2;i<=n;i++){
if(!st[i]) {
primes[cnt++] = i;
for(int j = i;j<=n/i;j++)
st[i*j] = true;
}
}
}
int main()
{
scanf("%lld",&n);
get_primes();
printf("%lld",cnt);
return 0;
}