只有#9没过,求解
查看原帖
只有#9没过,求解
1290600
ZhangJianbo820楼主2024/2/27 21:26

题目说:提前的时间不会超过一天,我是这么理解的。

s, v = map(int, input().split())
t = int(s / v) + 11
h = t // 60
m = t % 60
if h > 7:
    h = 24 - (h - 7)
    if h < 8:
    	# 时间超过一天
        print("08:01")
    else:
        print(f"{str(h).zfill(2)}:{str(60 - m).zfill(2)}")
else:
    h = 7 - h
    print(f"{str(h).zfill(2)}:{str(60 - m).zfill(2)}")

只有#9错误。

如果忽略那句话,一直往前推时间,还是只有#9错的,这段代码有什么问题吗?求指点!

s, v = map(int, input().split())
t = int(s / v) + 11
t = t % (24 * 60)
h = t // 60
m = t % 60
if h > 7:
    h = 24 - (h - 7)
else:
    h = 7 - h
print(f"{str(h).zfill(2)}:{str(60 - m).zfill(2)}")
2024/2/27 21:26
加载中...