题解 | #放苹果#
# 盘子数大于苹果树f(m,n) = f(m,m)
# 盘子数小于苹果树则:
# (1)至少一个盘子为空:f(m, n) = f(m, n-1)
# (2)没有盘子为空:f(m, n) = f(m-n,n)
# 递归出口:
# (1)没有苹果:m ==0 ,出
# (2)盘子数 n==1,出
def f(m, n):
if m == 0 or n == 1:
return 1
elif m < n:
return f(m, m)
elif m >= n:
return f(m,n-1) + f(m-n,n)
while True:
try:
m, n = map(int,input().strip().split())
print(f(m, n))
except EOFError:
break