python 蓝桥杯 阶乘计算高精度

n=int(input())
a=[0 for i in range(4000)]
a[0]=1
jw=0
for i in range(2,n+1):
    for j in range(len(a)):
        a[j] = a[j] * i + jw
        jw = int(a[j] / 10)
        a[j] = a[j] % 10
for x in range(len(a)-1,-1,-1):
    if a[x]!=0:
        break
    a.pop(x)
for i in range(len(a)-1,-1,-1):
    print(a[i],end='')

你可能感兴趣的:(leetcode,算法,职场和发展)