-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy path_9020.java
More file actions
50 lines (44 loc) ยท 892 Bytes
/
_9020.java
File metadata and controls
50 lines (44 loc) ยท 892 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
45
46
47
48
49
50
package backjoon;
// https://www.acmicpc.net/problem/9020
// ๊ณจ๋๋ฐํ์ ์ถ์ธก
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class _9020 {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
//memory 20740 runtime 568
int testCase = Integer.parseInt(br.readLine());
int first = 0;
int second = 0;
for(int i=0; i<testCase; i++){
int N = Integer.parseInt(br.readLine());
for(first=N/2, second=N/2;;first--,second++){
N = first + second;
if(isPrime(first) && isPrime(second)){
System.out.println(first + " " + second);
break;
}
}
}
}
static boolean isPrime(int n){
for(int i=2; i<n; i++){
if(n%i == 0){
return false;
}
}
return true;
}
}
/*
input
3
8
10
16
output
3 5
5 5
5 11
*/