本题比较抽象,参考了很多种答案与视频,现在将比较好的答案与视频放在下方供参考:
def func(m, n):
if m < 0 or n < 0:
return 0
elif m == 1 or n == 1:
return 1
else:
return func(m, n-1) + func(m-n, n)
while True:
try:
m,n = map(int, input().split())
if m < n:
print(func(m, m))
else:
print(func(m, n))
except:
break