import java.math.BigInteger;
import java.util.Scanner;
class Main{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long n = sc.nextLong();
BigInteger num = new BigInteger("1");
if(n<=2){
System.out.println(2);
return;
}else{
if(n%2 != 0){
BigInteger t1 = new BigInteger(n+"");
BigInteger t2 = new BigInteger((n-1)+"");
BigInteger t3 = new BigInteger((n-2)+"");
num=num.multiply(t1).multiply(t2).multiply(t3);
}else{
if(n%3 == 0){
BigInteger t1 = new BigInteger((n-3)+"");
BigInteger t2 = new BigInteger((n-1)+"");
BigInteger t3 = new BigInteger((n-2)+"");
num=num.multiply(t1).multiply(t2).multiply(t3);
}else{
BigInteger t1 = new BigInteger(n+"");
BigInteger t2 = new BigInteger((n-1)+"");
BigInteger t3 = new BigInteger((n-3)+"");
num=num.multiply(t1).multiply(t2).multiply(t3);
}
}
}
System.out.println(num);
}
}
蓝桥杯 算法训练 最大最小公倍数 JAVA
最新推荐文章于 2022-04-01 18:23:50 发布