Skip to content

Instantly share code, notes, and snippets.

@KSH-code
Last active June 27, 2018 09:12
BOJ 백준온라인져지 11653 소인수분해 풀이
import java.util.*;
import java.io.*;
/**
* https://www.acmicpc.net/problem/11653
* BOJ 백준온라인져지 11653 소인수분해 풀이
*/
public class Main {
private static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
public static void main(String args[]) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int N = Integer.parseInt(br.readLine());
for (int i = 2; i * i <= N; i++) {
if (N % i == 0) {
N /= i;
bw.write(String.valueOf(i--));
bw.write("\n");
}
}
if (N > 1) bw.write(String.valueOf(N));
bw.flush();
}
}
@KSH-code
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment