佬,我有个问题,我是模拟答案是对的,但提交答案就错了怎么回事呀
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int t=in.nextInt();
for(int i=0;i<t;i++){
int n=in.nextInt();
//Main a=new Main();
int x=charge(n);
System.out.println(x);
}
in.close();
}
public static boolean bool(int a){
if(a<2){
return false;
}
for(int i=2;i*i<=a;i++){
if(a%i==0){
return false;
}
}
return true;
}
public static int charge(int x){
if(bool(x)){
return 1;
}
for(int i=2;i*i<=x;i++){
if(x%i==0){
int primary=x/i;
if(bool(primary)){
return i;
}
}
}
return 0;
}