不好意思,刚才将自己发布的代码复制netbean6中RUN一下,原来有语法错误,原来JAVA不能
int tmp[4];
这样定义数组,这是C的定义(在下以前一直是C和汇编,没想到JAVA不是这样的)。
所以改为
int[] tmp = new int[4];
就OK了。
以下为全代码,在下在netbean6中RUN过了,没问题:
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package test;
/**
*
* @author root
*/
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
int a, b, c, d, e;
int[] tmp = new int[4];
for(a=1; a<18; a++){
tmp[0] = (100 - a - 1 - (1+1) - (1+1+1)) / 4;
for(b =a+1; b<=tmp[0]; b++){
tmp[1] = (100 - a - b - 1 - (1+1)) / 3;
for (c=b+1; c<=tmp[1]; c++){
tmp[2] = (100 - a - b - c - 1) /2;
for(d=c+1; d<=tmp[2]; d++){
tmp[3] = (100 - a - b - c - d);
for(e=d+1; e<=tmp[3]; e++){
if (a+b+c+d+e<100){
System.out.println(a+" "+b+" "+c+" "+d+" "+e);
}else{
break;
}
}
}
}
}
}
}
}