public class Test_A23 { public static void main(String[] args){ int count=0; for(int i=1;i<=4;i++){ for(int j=1;j<=4;j++){ for(int k=1;k<=4;k++){ if(i!=j &&i!=k && j!=k){ int number=i*100+j*10+k; System.out.print(" "+number); count++; } } } } System.out.println(); System.out.println("共有"+count+"个符合条件的三位数"); } }
实现有1、2、3、4个数字,能组成多少个互不相同且无重复数字的三位数?都是多少?
2024-06-14 23:04:04 36 阅读