60分求助!!!
4个点TLE
#include<bits/stdc++.h>
using namespace std;
int pd(int n) {
for(int i=2; i*i<=n; i++)
if(n%i==0) return 0;
return 1;
}
int x,y,ans;
int main() {
cin>>y;
if(x==1) {
for(int i=3; i<=y; i++) {
if(pd(i)) ans++;
}
ans++;
} else {
for(int i=2; i<=y; i++) {
if(pd(i)) ans++;
}
}
cout<<ans<<endl;
return 0;
}