-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBAEKJOON_11653
More file actions
49 lines (34 loc) ยท 1.08 KB
/
BAEKJOON_11653
File metadata and controls
49 lines (34 loc) ยท 1.08 KB
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
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int num = Integer.parseInt(br.readLine());
int fi_num= num;
StringBuilder sb = new StringBuilder();
for(int i=2; i<=num; i++){
while(true){
if(fi_num %i ==0){
sb.append(i);
sb.append(" ");
fi_num = fi_num / i;
}else{
break;
}
}
}
String str = sb.toString();
StringTokenizer st = new StringTokenizer(str);
int[] arr = new int[st.countTokens()];
for(int i=0; i<arr.length; i++){
arr[i] = Integer.parseInt(st.nextToken());
}
Arrays.sort(arr);
for(int res : arr){
System.out.println(res);
}
}
}