-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path1561_PRIME.cpp
More file actions
40 lines (33 loc) · 862 Bytes
/
Copy path1561_PRIME.cpp
File metadata and controls
40 lines (33 loc) · 862 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Problem#: 1561
// Submission#: 901421
// The source code is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
// URI: http://creativecommons.org/licenses/by-nc-sa/3.0/
// All Copyright reserved by Informatic Lab of Sun Yat-sen University
#include <iostream>
#include <cmath>
using namespace std;
int prime = 2;
int post = 1;
int main()
{
int n;
cin >> n;
for(;post<n;post++)
{
while(1)
{
prime++;
bool k=0;
for(int i=2;i <= sqrt(prime); i++)
{
if(prime % i == 0)
{
k=1;
break;
}
}
if(k == 0)break;
}
}
cout << prime << endl;
}