Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- inline void file()
- {
- ios_base::sync_with_stdio(false);
- cin.tie(0);
- cout.tie(0);
- if(0)
- {
- freopen(".in", "r", stdin);
- freopen(".out","w", stdout);
- }
- }
- bool p[1001];
- int n, k;
- int main()
- {
- cin >> n >> k;
- for(int i = 2; i <= n; i++)
- {
- if(!p[i])
- {
- for(int j = i; j <= n; j += i)
- {
- if(p[j])
- continue;
- k--;
- if(!k)
- {
- cout << j ;
- return 0;
- }
- p[j] = true;
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement