动态规划:蜗牛爬井问题
一只蜗牛白天爬4米,晚上掉2米,n米的井,蜗牛几天才能爬出来
def costDay(n):
if n==0:
return 0
elif n<=4:
return 1
else:
ans=
动态规划:蜗牛爬井问题
一只蜗牛白天爬4米,晚上掉2米,n米的井,蜗牛几天才能爬出来
def costDay(n):
if n==0:
return 0
elif n<=4:
return 1
else:
ans=