题目:
解决方法:
package com.algorithm.java.blueBirdge; import java.lang.reflect.Array; import java.util.ArrayList; import java.util.Arrays; import java.util.Scanner; public class leastCommonMultiple { public static void main(String[] args){ Scanner read =new Scanner(System.in); int n=read.nextInt(); System.out.println(ICD(n,n-1,n-2));//赋值 } public static int ICD(int a,int b,int c){//求最小公倍数 //int k=getMax(a,b,c); for (int i=a*b;;i++){ if(i%a==0 && i%b==0 && i%c==0){ return i; } } }/* public static int getMax(int a ,int b,int c){//求最大值 int []aa={a,b,c}; Arrays.sort(aa) ; return aa[2]; }*/ }
运行超时!
原文地址:https://www.cnblogs.com/Catherinezhilin/p/8505099.html
时间: 2024-10-18 01:31:21