斯特林公式是一条用来取n!的近似值的数学公式,也可用来求取n!的位数。 //在x进制下的位数 LL res = (LL)((log(2 * pi*n) / 2 + n*log(n) - n) / log(x));