#38432: python NA問題 求助

#### san19980117@gmail.com (Kris)

School : No School
ID : 256181
2023-12-18 16:23:08
e808. 3.不再傻傻等公車 (Bus) -- | From: [211.75.181.229] | Post Date : 2023-11-23 09:44

n=int(input())
h,m=map(int,input().split())
arrivaltime=[]
for i in range(n+1):
if i==0:
arrivaltime.append([h,m])
else:
temp_m=arrivaltime[i-1][1]+int(input())
if temp_m>=60:
temp_h=arrivaltime[i-1][0]+1
temp_m-=60
else:
temp_h=arrivaltime[i-1][0]
temp_h-=24 if temp_h>=24 else 0
arrivaltime.append([temp_h,temp_m])
query=input().split()
for i in range(len(query)):
index=int(query[i])
if index==0:
break
else:
stop_h=str(arrivaltime[index][0])
stop_m=str(arrivaltime[index][1])
if len(stop_h)==1:
stop_h='0'+stop_h
if len(stop_m)==1:
stop_m='0'+stop_m
print("{}:{}".format(stop_h,stop_m))

#38528: Re: python NA問題 求助

#### cges30901 (cges30901)

School : No School
ID : 30877
2024-09-03 08:48:54
e808. 3.不再傻傻等公車 (Bus) -- | From: [101.136.60.79] | Post Date : 2023-12-03 17:27

temp_m=arrivaltime[i-1][1]+int(input())
if temp_m>=60:
temp_h=arrivaltime[i-1][0]+1
temp_m-=60

temp_m有可能超過120

ZeroJudge Forum