输入:有一口深度为high米的水井,井底有一只青蛙,它每天白天能够沿井壁向上爬up米,夜里则顺井壁向下滑down米,若青蛙从某个早晨开始向外爬,对于任意指定的high、up和down值(均为自然数),计算青蛙多少天能够爬出井口?
输出:输入3个正整数:high、up和down。
样例输入:输出一个整数,表示天数。输出单独占一行。
样例输出:10 2 1
程序代码:9
a=input().split()
b=[]
k=sum1=0
day=1
for i in range(1,4) :
b.append(int(a[k]))
k+=1
while True :
sum1+=b[1]
if sum1>=b[0] :
break
sum1-=b[2]
day+=1
print(day)