//正向思维想出一种新算法,大家看看对不对,看看执行效率哪个更好
class FetchNum {
int a,b,c,i,j,k,count=0;
int s[]=new int [100];
public void fetchNum() {
for (i=1;i<=4;i++){
for (j=1;j<=4;j++){
for (k=1;k<=4;k++){
if (i!=j&&i!=k&&j!=k){
s[count]=i*100+j*10+k;
System.out.print(s[count]+" \t");
count++;
}
}
}
}
System.out.println("--------------------------------------------------------------------------------");
System.out.println(count);
System.out.println("--------------------------------------------------------------------------------");
for (i=0;i<count;i++){
System.out.print(s[i]+"\t ");
}
}
}
|