Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import datetime as dt
- def in_range(cur):
- cur = cur - null_date
- cur = cur.days
- return birth <= cur <= death
- first = [int(x) for x in input().split()]
- second = [int(x) for x in input().split()]
- birth = [int(x) for x in input().split()]
- death = [int(x) for x in input().split()]
- first = dt.date(year=first[0], month=first[1], day=first[2])
- second = dt.date(year=second[0], month=second[1], day=second[2])
- birth = dt.date(year=birth[0], month=birth[1], day=birth[2])
- death = dt.date(year=death[0], month=death[1], day=death[2])
- null_date = dt.date(year=1, month=1, day=1)
- delta = second - first
- birth = birth - null_date
- birth = birth.days
- death = death - null_date
- death = death.days
- ans = 0
- if in_range(first):
- ans += 1
- cur_first = first
- while True:
- try:
- cur_first += delta
- if in_range(cur_first):
- ans += 1
- except Exception:
- break
- cur_first = first
- while True:
- try:
- cur_first -= delta
- if in_range(cur_first):
- ans += 1
- except Exception:
- break
- print(ans)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement