51nod1130:大数阶乘长
斯特林近似问题:

斯特林公式推导:

import java.util.Scanner;

public class nod1130 {
	public static void main(String[] args) {
		final double PI = Math.PI;//API中有直接的PI和e调用
		final double e = Math.E;
		Scanner in = new Scanner(System.in);
		int T = in.nextInt();
		while (T-- > 0) {
			long n = in.nextLong();
			long ans = (long) (Math.log10(2 * PI * n) / 2 + n
					* Math.log10(n / e) + 1);
			System.out.println(ans);
		}
	}
}