不知道为什么通不过呢
def exchange(num):
if num==1:
return 0
else:
if num%2==0:
return int(num/2)
else:
return int((num-1)/2)
while True:
try:
a=1
line=[]
while(a!=0):
a=int(input())
if a==0:
break
else:
line.append(a)
for i in range(len(line)):
print(exchange(line[i]))
except:
break
def exchange(num):
if num==1:
return 0
else:
if num%2==0:
return int(num/2)
else:
return int((num-1)/2)
while True:
try:
a=1
line=[]
while(a!=0):
a=int(input())
if a==0:
break
else:
line.append(a)
for i in range(len(line)):
print(exchange(line[i]))
except:
break
「求助大佬帮看看这道算法题吧!」 有这样一道智力题:“某商店规定:三个空汽水瓶可以换一瓶汽水。小张手上有十个空汽水瓶,她最多可以换多少瓶汽水喝?”答案是5瓶,方法如下:先用9个空瓶子换3瓶汽水,喝掉3瓶满的,喝完以后4个空瓶子,用3...
https://gw-c.nowcoder.com/api/sparta/jump/link?link=https%3A%2F%2Fwww.nowcoder.com%2FquestionTerminal%2Ffe298c55694f4ed39e256170ff2c205f
全部评论
相关推荐


游卡
| 校招
| 超多精选岗位

点赞 评论 收藏
分享
点赞 评论 收藏
分享
点赞 评论 收藏
分享