HDACM 1405
格式!!!
两行之间才有一空行
每行的格式 60: 2+” “+2 +” “+3 +” “+1+” “+ 5+” “+ 1+” “
import java.util.Scanner;public class Main{public static void main(String[] args) {Scanner sc = new Scanner(System.in);int i = 1;while (sc.hasNext()) {int n = sc.nextInt();if (n < 0) {break;}if (i!=1) {System.out.println();}System.out.println("Case "+i+".");int k = 2;int count = 0;while(n>1){if (n%k==0) {n /= k;count++;continue;}if (count>0) {System.out.print(k+" "+count+" ");}k++;count = 0;}System.out.println(k+" "+count+" ");i++;}sc.close();}
}