public class BallGame_test {
static boolean aTrue;
static boolean bTrue;
static int judge(int m,int n,int p){
if(aTrue)return 0;
if(m==1&&n==1)
{
System.out.println("**");
aTrue=true;
return 0;
}
if(n==1)bTrue=true;
while(p>1)
{
if(m%p==0)judge(m/p,n,p-1);
if(n%p==0)judge(m,n/p,p-1);
p--;
}
return 0;
}
public static void main(String[] args) {
// TODO Auto-generated method stub
int tMax,tMin;
tMax=343;
tMin=49;
aTrue=false;
bTrue=false;
judge(tMax,tMin,100);
if(!aTrue&&bTrue)
System.out.println("结果是:"+tMin);
else
System.out.println("结果是:"+tMax);
}
}
|
|