Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def calculate_distance(point, ice_cream):
- return point, min(point % ice_cream, ice_cream - (point % ice_cream))
- school, club, ice_cream = map(int, input().split())
- if school % 2 == club % 2:
- print(calculate_distance((school + club) // 2, ice_cream))
- else:
- print(min(
- calculate_distance((school + club) // 2, ice_cream),
- calculate_distance((school + club) // 2 + 1, ice_cream),
- key=lambda x: x[1],
- ))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement