count = 0
def aaa(n, left):
if left == 0:
global count
count += 1
return
for i in range(1, left + 1):
aaa(i, left - i)
def main():
n = int(input())
aaa(0, n)
print(count)
main()
python实现递归在递归体中用全局变量需要申明
最新推荐文章于 2024-11-11 09:32:23 发布