质数因子
质数因子
http://www.nowcoder.com/questionTerminal/196534628ca6490ebce2e336b47b3607
import java.util.*; public class Main { public Main() { Scanner in = new Scanner(System.in); while (in.hasNextLong()) { long n = in.nextLong(); StringBuilder output = new StringBuilder(); for (int i = 2; i <= n; i++) { while (n % i == 0) { output.append(i).append(" "); n /= i; } } System.out.println(output); } } public static void main(String[] args) { Main solution = new Main(); } }