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