代码:
1 import java.util.*; 2 public class Main { 3 public static void main (String [] args) { 4 Scanner cin=new Scanner(System.in); 5 int n=cin.nextInt(); 6 int num=0; 7 for(int b=1;b<=n;b++) { 8 for(int s=0;s<=n;s++) { 9 for(int g=0;g<=n;g++) { 10 if(b!=s&&b!=g&&s!=g) { 11 num++; 12 } 13 } 14 } 15 } 16 System.out.println(num); 17 } 18 }
原文地址:https://www.cnblogs.com/fandehui/p/11040698.html
时间: 2024-11-03 23:53:05