题解 | #质数因子#
质数因子
https://www.nowcoder.com/practice/196534628ca6490ebce2e336b47b3607
import java.util.Scanner fun main(args: Array<String>) { val read = Scanner(System.`in`) var ans = read.nextLong() val sqr = Math.sqrt(ans.toDouble()).toLong() var i = 2 while (i<=sqr) { if((ans % i) == 0L) { print("$i ") ans /= i } else { i ++ } } println(if (ans==1L) "" else "$ans ") }