放苹果问题,为啥通不过。。。好像int行不通啊,IDE里没问题
放苹果
http://www.nowcoder.com/questionTerminal/bfd8234bb5e84be0b493656e390bdebf
import sys
def apple_method(m,n):
if m == 0 or n ==1:
return 1
if n > m:
return apple_method(m,m)
else:
return apple_method(m, n-1) + apple_method(m-n, n)
if name == 'main':
while True:
m = sys.stdin.readline().strip()
if m == '':
break
n = sys.stdin.readline().strip()
m = int(m)
n = int(n)
result = apple_method(m, n)
print(result)