题意
求最小公倍数。
思路
用Java搞搞就行。
可能有些人报了MLE,这时候你需要每次计算完之后加一个System.gc();
代码
import java.io.*;
import java.math.*;
import java.util.*;
public class Main {
public static void main(String args[]) {
int cases = 0;
Scanner in = new Scanner(new BufferedInputStream(System.in));
int T = in.nextInt();
while (T-- > 0) {
BigInteger ans = BigInteger.ONE;
int n = in.nextInt();
while (n-- > 0) {
BigInteger tmp = in.nextBigInteger();
ans = ans.divide(ans.gcd(tmp)).multiply(tmp);
}
System.out.printf("Case %d: ", ++cases);
System.out.println(ans);
System.gc();
}
}
}