import sys
def read_input():
x, d, h, m = map(int, sys.stdin.readline().strip().split())
return x, d, h, m
daty = {
1: 24,
2: 25,
3: 26,
4: 27,
5: 29
}
def compuute(x, d, h, m):
if x != 5:
if d == daty[x]:
return ((24-h)*60 - m)
else:
return ((24-h)*60 - m) + 24*60
else:
if d == 29:
if h > 2:
return ((24-h)*60 - m)
else:
return ((23-h)*60 - m)
if d == 28:
return ((24-h)*60 - m) + 23*60
if d == 27:
return ((24-h)*60 - m) + 47*60
x, d, h, m = read_input()
print(compuute(x, d, h, m))
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 32 33 34 35 | import sys def read_input(): x, d, h, m = map(int, sys.stdin.readline().strip().split()) return x, d, h, m daty = { 1: 24, 2: 25, 3: 26, 4: 27, 5: 29 } def compuute(x, d, h, m): if x != 5: if d == daty[x]: return ((24-h)*60 - m) else: return ((24-h)*60 - m) + 24*60 else: if d == 29: if h > 2: return ((24-h)*60 - m) else: return ((23-h)*60 - m) if d == 28: return ((24-h)*60 - m) + 23*60 if d == 27: return ((24-h)*60 - m) + 47*60 x, d, h, m = read_input() print(compuute(x, d, h, m)) |
English