Algorithm/ct/l1/求阶乘位数.py

20 lines
319 B
Python
Raw Normal View History

2022-11-22 15:20:08 +08:00
import io
import sys
sys.stdin = io.StringIO('''2
10
20''')
from math import pi, e, log10, ceil
m = int(input())
for _ in range(m):
num = int(input())
if num == 0 or num == 1:
print(1)
continue
digit = ceil(log10(float(2 * pi * num)) / 2 + num * log10(float(num / e)))
print(digit)