x, d, h, m = map(int, input().split())
end_days = {
1: 24,
2: 25,
3: 26,
4: 27,
5: 29
}
end_day = end_days[x]
end_hour = 23
end_min = 59
def to_minutes(day, hour, minute):
return (day * 24 + hour) * 60 + minute
start = to_minutes(d, h, m)
end = to_minutes(end_day, end_hour, end_min)
result = end - start
dst_day = 29
dst_hour = 2
dst_time = to_minutes(dst_day, dst_hour, 0)
if start < dst_time <= end:
result -= 60
print(result+1)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | x, d, h, m = map(int, input().split()) end_days = { 1: 24, 2: 25, 3: 26, 4: 27, 5: 29 } end_day = end_days[x] end_hour = 23 end_min = 59 def to_minutes(day, hour, minute): return (day * 24 + hour) * 60 + minute start = to_minutes(d, h, m) end = to_minutes(end_day, end_hour, end_min) result = end - start dst_day = 29 dst_hour = 2 dst_time = to_minutes(dst_day, dst_hour, 0) if start < dst_time <= end: result -= 60 print(result+1) |
English