-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path9020.py
More file actions
32 lines (29 loc) · 756 Bytes
/
9020.py
File metadata and controls
32 lines (29 loc) · 756 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
n = 10000
sieve = [True] * n
m = int(n ** 0.5)
for i in range(2, m + 1):
if sieve[i] == True:
for j in range(i+i, n, i):
sieve[j] = False
arr = [i for i in range(2, n) if sieve[i] == True]
num = int(input())
for x in range(num) :
a = int(input())
aa = 0
for z in range(0, 1228):
if a <= arr[z] :
break
else :
aa += 1
k = float("inf")
sol = [0, 0]
for i in range(aa) :
if sieve[a - arr[i]] == True :
P = max(arr[i], a - arr[i])#7
p = min(arr[i], a - arr[i])#3
m = P - p
if m < k :
k = m
sol[0] = p
sol[1] = P
print("%d %d" %(sol[0], sol[1]))