import sys
def solve():
x, d, h, m = map(int, sys.stdin.read().split())
end_day = 23 + x if x <= 4 else 29
minutes = (end_day - d) * 1440 + (24 - h) * 60 - m
if x == 5 and (d < 29 or (d == 29 and h < 2)):
minutes -= 60
print(minutes)
solve()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | import sys def solve(): x, d, h, m = map(int, sys.stdin.read().split()) end_day = 23 + x if x <= 4 else 29 minutes = (end_day - d) * 1440 + (24 - h) * 60 - m if x == 5 and (d < 29 or (d == 29 and h < 2)): minutes -= 60 print(minutes) solve() |
English