-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path10394.cpp
More file actions
32 lines (30 loc) · 697 Bytes
/
10394.cpp
File metadata and controls
32 lines (30 loc) · 697 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
#include <bits/stdc++.h>
int const max = 18410011;
int const min = 100001;
int a[max];
long long b[min];
int main() {
int i, j, n;
for (i = 3; i <= max; i++) {
a[i] = 1;
}
for (i = 2; i <= max; i += 2) a[i] = 0;
for (i = 3; i * i <= max; i += 2) {
if (a[i] == 1)
for (j = i * i; j <= max; j += i) a[j] = 0;
}
for (i = 3; i < 18410000; i += 2) {
if (a[i] == 1 && a[i + 2] != 1) a[i] = 0;
}
j = 1;
for (i = 3; i < 18410000; i += 2) {
if (a[i] == 1) {
b[j] = i;
j++;
}
}
while (scanf("%d", &n) == 1) {
printf("(%lld, %lld)\n", b[n], b[n] + 2);
}
return 0;
}