-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbj_9020.cpp
More file actions
44 lines (38 loc) · 872 Bytes
/
bj_9020.cpp
File metadata and controls
44 lines (38 loc) · 872 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
41
42
43
44
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main() {
int n;
cin.tie(NULL);
cout.tie(NULL);
ios_base::sync_with_stdio(false);
cin >> n;
int prime[10001] = {};
prime[1] = 1;
for(int i = 2; i<= 10000; i++) {
if(prime[i] != 1) {
for(int j = i*2; j<= 10000; j += i) {
prime[j] = 1;
}
}
}
for(int i = 0; i < n; i++) {
int num;
cin >> num;
bool check = false;
int a = 0;
int b = 0;
int min = 10000;
for(int i = 2; i<= num/2; i++) {
if(prime[i] == 0 && prime[num-i] == 0) {
if(num-2*i < min) {
a = i;
b = num-i;
}
}
}
cout << a << " " << b << "\n";
}
return 0;
}