2022-01-22 10:18
Pennsylvania State University Park FPGA工程师 0 点赞 评论 收藏
分享
投递华为等公司10个岗位 >
0 点赞 评论 收藏
分享
2019-09-05 15:18
Pennsylvania State University Park FPGA工程师 0 点赞 评论 收藏
分享
焦糖布拿铁:根据Neyanbhbin以及变戏法的羊的解答,我最终将程序修改如下,并通过: import sys
lines = []
for line in sys.stdin:
a=int(line)
if a!=0:
lines.append(a)
lenLine = len(lines)
def MaxBottleNum(Num):
rest = (Num%3)
n = (Num//3)
New_Num = n + rest
while((New_Num)>=3):
n +=(New_Num//3)
rest1 = New_Num%3
New_Num = rest1 + (New_Num//3)
if New_Num == 2:
n += 1
return n
for i in range(lenLine):
num = lines[i]
print(MaxBottleNum(num))
0 点赞 评论 收藏
分享
关注他的用户也关注了: