Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for _ in range(10):
- n, m, d = map(int, input().split())
- events = [int(a) for a in input().split()]
- # Amount of shirts he has in total, dirty or clean.
- num_shirts = n
- # Number of days he had to do the laundry.
- laundry = 0
- for day in range(1, d + 1):
- if n == 0:
- # He does the laundry, so we refresh the amount of shirts
- # and increment the laundry variable.
- n = num_shirts
- laundry += 1
- # He wore a shirt, so decrement from the amount of clean shirts.
- n -= 1
- # Multiple events can occur in one day.
- # This works because if the day is not in events, it'll return 0
- # anyways. Adding 0 to num_shirts won't change its value.
- events_today = events.count(day)
- num_shirts += events_today
- n += events_today
- print(laundry)
Add Comment
Please, Sign In to add comment