1 回答
TA贡献2条经验 获得超0个赞
Java中输出字符串要用双引号,给你改了一下
public static void main(String[] args) {
// TODO Auto-generated method stub
int a=0,b=0,c=0,d=0,e=0,f=0,g=0,h=0,i=0;
for(a=1;a<=9;a++){
for(b=1;b<=9;b++){
for(c=1;c<=9;c++){
for(d=1;d<=9;d++){
for(e=1;e<=9;e++){
for(f=1;f<=9;f++){
for(g=1;g<=9;g++){
for(h=1;h<=9;h++){
for(i=1;i<=9;i++){
if(a*c*(g*100+h*10+i)+b*(g*100+h*10+i)+(d*100+e*10+f)==10*(g*100+h*10+i)*c){
System.out.println(a+"-"+b+"-"+c+"-"+d+"-"+e+"-"+f+"-"+g+"-"+h+"-"+i);
}
}
}
}
}
}
}
}
}
}
}
控制台效果
9-4-9-5-5-5-1-1-1
9-4-9-5-6-5-1-1-3
9-4-9-5-7-5-1-1-5
9-4-9-5-8-5-1-1-7
9-4-9-5-9-5-1-1-9
9-4-9-6-1-5-1-2-3
9-4-9-6-2-5-1-2-5
9-4-9-6-3-5-1-2-7
9-4-9-6-4-5-1-2-9
9-4-9-6-5-5-1-3-1
9-4-9-6-6-5-1-3-3
9-4-9-6-7-5-1-3-5
9-4-9-6-8-5-1-3-7
9-4-9-6-9-5-1-3-9
添加回答
举报