http://e-tutor.itsa.org.tw/e-Tutor/mod/programming/view.php?id=468
這題比long還要大所以要使用大數運算BigInteger才會過
import java.math.BigInteger;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner scn = new Scanner(System.in);
int n = scn.nextInt();
while (n-- != 0) {
BigInteger a = scn.nextBigInteger(), tot = new BigInteger("1");
while (!a.equals(new BigInteger("1"))) {
tot = tot.multiply(a);
a = a.subtract(new BigInteger("1"));
}
System.out.println(tot);
}
}
/*
題目:[C_RU01-易] 矩陣練習
作者:1010
時間:西元 2016 年 7 月 */
}