Пересечение отрезков
https://veretennikovalexey.github.io/docs/python4/ # Function to find the intersection of two segments def find_intersection(a1, a2, b1, b2): # Calculate the maximum of the starting points and the minimum of the ending points start = max(a1, b1) end = min(a2, b2) # Check if the segments intersect if start (меньше) end: return f"{start} {end}" elif start == end: return f"{start}" else: return "пустое множество" # Read input values a1, a2, b1, b2 = int(input()), int(input()), int(input()), int(input()) # Print the result of the intersection
Название:
Пересечение отрезков
Категория:
Разное