平方根都没必要: import java.util.*; import java.io.*; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); while (scanner.hasNext()) { int n = scanner.nextInt(); for (int i = 2; i <= n;) { if (n % i == 0) { System.out.print(i + " "); n = n / i; } else { i++; } } } } }
5

相关推荐

点赞 评论 收藏
分享
牛客网
牛客企业服务