Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from sys import stdin
- def isLeap(y):
- return (y%4==0 and y%100!=0) or y%400==0
- month = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
- # from 0/1/1
- def day_since_epoch(y, m, d):
- ret = d + (y-1)*365
- ret += (y-1)//4 - (y-1)//100 + (y-1)//400
- for i in range(1, m):
- ret += month[i]
- if i==2 and isLeap(y):
- ret += 1
- return ret
- line = 0
- y1, m1, d1, y2, m2, d2 = [0]*6
- for s in stdin:
- line += 1
- if line&1:
- y1, m1, d1 = map(int, s.split())
- continue
- y2, m2, d2 = map(int, s.split())
- ans1 = day_since_epoch(y1, m1, d1)
- ans2 = day_since_epoch(y2, m2, d2)
- if ans1 > ans2:
- ans1, ans2 = ans2, ans1
- print(ans2 - ans1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement