#48158: python 解法


olivia080326@gmail.com (嘻嘻)

學校 : 臺北市立中正高級中學
編號 : 239248
來源 : [1.160.192.170]
最後登入時間 :
2025-09-20 23:00:17

import sys
def f(x):
    
    if x==0 or x==1:
        print("1", end="")
        return 1
    else:
        print(f"{x} * ", end="")
        return f(x-1)*x
    

for s in sys.stdin:
    x=int(s)
    print(f"{x}! = ", end="")
    ans=f(x)
    print(f" = {ans} ")