吸血鬼问题,求助,调试通过,运行的时候什么也没有
吸血鬼问题,求助,调试通过,运行的时候什么也没有 ~! 求帮忙啊 !!~
class Vampire2
{
public boolean number(int sum)
{
int[] vam = new int[4];
vam[0] = sum / 1000;
vam[1] = ((sum - sum * 1000) / 100);
vam[2] = ((sum - sum * 1000 - vam[1] * 100) / 10);
vam[3] = (sum - sum * 1000 - vam[1] * 100 - vam[2] * 10);
if(vam[2] == 0 && vam[3] == 0)
{
return false;
}
for (int i = 0; i < 4; i++)
{
for (int j = 0; j < 4; j++)
{
for (int k = 0; k < 4; k++)
{
for (int l = 0; l < 4; l++)
{
if (i != j && i != k && i != l && j != k && j != l && j != l && k != l)
{
int n1 = vam[i] * 10 + vam[j];
int n2 = vam[k] * 10 + vam[l];
if(n1 * n2 == sum)
{
System.out.println(sum + " = " + n1 + " * " + n2);
return true;
}
}
}
}
}
}
return false;
}
public static void main(String[] args)
{
Vampire2 vampire = new Vampire2();
for(int num = 1000; num < 10000; num++)
{
vampire.number(num);
}
}
}