class Test {
public static void main(String[] args) {
//有1,2,3,4 个数字,问能组成多少个互不相同且无重复数字的三位数。,都是多少
String[] str1 = {"1","2","3","4"};
String[] str2 = str1;
String[] str3 = str1;
int count = 0;
for(int i=0;i<str1.length;i++){
for(int j=0;j<str2.length;j++){
for(int k=0;k<str3.length;k++){
if(i!=j && j != k && k != i){
System.out.println(str1[i]+str2[j]+str3[k]);
count++;
}
}
}
}
System.out.println("总共有"+count+"个");
}
}
|