DontCallMeNuttoPleas

Prime

May 5th, 2020
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.32 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. using lli= long long;
  4. bool check[10000000];
  5. int main(){
  6.     int cnt=0;
  7.     int n;
  8.     scanf("%d",&n);
  9.     for(int i=2;i<10000000;i++){
  10.         if(check[i]) continue;
  11.         cnt++;
  12.         if(cnt>=n){
  13.             printf("%d",i);
  14.             return 0;
  15.         }
  16.         for(int j=i+i;j<10000000;j+=i){
  17.             check[j]=true;
  18.         }
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment