1 solutions
-
0
#include<bits/stdc++.h> using namespace std; const int N=1e5+10; vector<int> p; bool st[N]; void get(int n) { for(int i=2;i<=n;i++) { if(!st[i]) p.push_back(i); for(int j=0;p[j]*i<=n;j++) { st[i*p[j]]=1; if(i%p[j]==0) break; } } } int main() { int n; cin>>n; get(n); cout<<p.size()+1; return 0; }
- 1
Information
- ID
- 2892
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 10
- Tags
- # Submissions
- 2
- Accepted
- 2
- Uploaded By