题解 | #质数因子#
质数因子
https://www.nowcoder.com/practice/196534628ca6490ebce2e336b47b3607
import java.util.Scanner; // 注意类名必须为 Main, 不要有任何 package xxx 信息 public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int num = in.nextInt(); int target = num; int y = 2; while(target != 1){ if(target % y == 0){ target /= y; System.out.print(y + " "); }else{ if(y * y > target){ y = target; } else{ y ++; } } } } }