Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- using lli= long long;
- bool check[10000000];
- int main(){
- int cnt=0;
- int n;
- scanf("%d",&n);
- for(int i=2;i<10000000;i++){
- if(check[i]) continue;
- cnt++;
- if(cnt>=n){
- printf("%d",i);
- return 0;
- }
- for(int j=i+i;j<10000000;j+=i){
- check[j]=true;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment