#10811: 不曉得哪裡寫錯了 請幫幫忙


d50110 (MaxCool)


import java.util.Scanner;

public class AAA {

public static void main(String[] args){

Scanner sc = new Scanner(System.in);

int count = 0;

while(sc.hasNext()){

int a = sc.nextInt();

for(int i = 2 ; i <= a ; i++){


if(a % i ==0){

count = 0;
while(a % i ==0){

count++;
a = a/i;
}
if(count != 1)
System.out.print(i + "^" + count);
else
System.out.print(i);
if(a != 1)
System.out.print(" * ");

}

}

}
sc.close();}
}

您的答案為: 2^2 * 3^2 * 7 * 173^2 * ...略
正確答案為: 2^2 * 3^2 * 7 * 17