#30981: python 5(2)行內解決


c8763yee (c8763yee)

學校 : 國立臺南高級工業職業學校
編號 : 102697
來源 : [211.20.7.115]
最後登入時間 :
2023-07-05 10:29:03
e357. 遞迴函數練習 | From: [27.240.192.230] | 發表日期 : 2022-06-28 16:31

f = lambda x: 1 if x==1 else (f(x-1)+f(x+1) if x%2 else f(x//2))
while True:
    try:
        print(f(int(input())))
    except EOFError:
        break
 
ZeroJudge Forum