Advertisement
Guest User

Untitled

a guest
Apr 21st, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.71 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. inline void file()
  5. {
  6.     ios_base::sync_with_stdio(false);
  7.     cin.tie(0);
  8.     cout.tie(0);
  9.     if(0)
  10.     {
  11.         freopen(".in", "r", stdin);
  12.         freopen(".out","w", stdout);
  13.     }
  14. }
  15.  
  16. bool p[1001];
  17. int n, k;
  18.  
  19. int main()
  20. {
  21.     cin >> n >> k;
  22.     for(int i = 2; i <= n; i++)
  23.     {
  24.         if(!p[i])
  25.         {
  26.             for(int j = i; j <= n; j += i)
  27.             {
  28.                 if(p[j])
  29.                     continue;
  30.                 k--;
  31.                 if(!k)
  32.                 {
  33.                     cout << j ;
  34.                     return 0;
  35.                 }
  36.                 p[j] = true;
  37.             }
  38.         }
  39.     }
  40.     return 0;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement