Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- """
- Created on Sat Nov 21 17:27:04 2020
- @author: Sergey
- """
- import math
- x1_1, y1_1 = int(input()), int(input())
- x1_2, y1_2 = int(input()), int(input())
- x2_1, y2_1 = int(input()), int(input())
- x2_2, y2_2 = int(input()), int(input())
- data=[[x1_1, y1_1], [x1_2, y1_2], [x2_1, y2_1], [x2_2, y2_2]]
- data1=[]
- for i in range(3):
- for j in range(i+1, 4):
- a=data[i]
- b=data[j]
- x1=a[0]
- y1=a[1]
- x2=b[0]
- y2=b[1]
- s= math.sqrt(((x2-x1)**2) + ((y2-y1)**2))
- data1.append(s)
- print(data1)
- c=max(data1)
- d=data1.index(c)
- data1.pop(d)
- data1.insert(d, 0)
- c1=max(data1)
- d1=data1.index(c1)
- data1.pop(d1)
- data1.insert(d1, 0)
- print('data1', data1)
- print(c)
- print(c1)
- if (c>data1[0]) and (c1>data1[0]) and (c>data1[1]) and (c1>data1[1]) and (c>data1[2]) (c1>data1[2]) and (c>data1[3]) and (c1>data1[3]) and (c>data1[4]) and (c1>data1[4]) and (c>data1[5]) and (c1>data1[5]):
- if d==0:
- x1_1, y1_1=data[0][0], data[0][1]
- x1_2, y1_2=data[1][0], data[1][1]
- elif d==1:
- x1_1, y1_1=data[0][0], data[0][1]
- x1_2, y1_2=data[2][0], data[2][1]
- elif d==2:
- x1_1, y1_1=data[0][0], data[0][1]
- x1_2, y1_2=data[3][0], data[3][1]
- elif d==3:
- x1_1, y1_1=data[1][0], data[1][1]
- x1_2, y1_2=data[2][0], data[2][1]
- elif d==4:
- x1_1, y1_1=data[1][0], data[1][1]
- x1_2, y1_2=data[3][0], data[3][1]
- elif d==5:
- x1_1, y1_1=data[2][0], data[2][1]
- x1_2, y1_2=data[3][0], data[3][1]
- if d1==0:
- x1_1, y1_1=data[0][0], data[0][1]
- x1_2, y1_2=data[1][0], data[1][1]
- elif d1==1:
- x1_1, y1_1=data[0][0], data[0][1]
- x1_2, y1_2=data[2][0], data[2][1]
- elif d1==2:
- x1_1, y1_1=data[0][0], data[0][1]
- x1_2, y1_2=data[3][0], data[3][1]
- elif d1==3:
- x1_1, y1_1=data[1][0], data[1][1]
- x1_2, y1_2=data[2][0], data[2][1]
- elif d1==4:
- x1_1, y1_1=data[1][0], data[1][1]
- x1_2, y1_2=data[3][0], data[3][1]
- elif d1==5:
- x1_1, y1_1=data[2][0], data[2][1]
- x1_2, y1_2=data[3][0], data[3][1]
- A1 = y1_1 - y1_2
- B1 = x1_2 - x1_1
- C1 = x1_1*y1_2 - x1_2*y1_1
- A2 = y2_1 - y2_2
- B2 = x2_2 - x2_1
- C2 = x2_1*y2_2 - x2_2*y2_1
- if B1*A2 - B2*A1 != 0:
- y = (C2*A1 - C1*A2) / (B1*A2 - B2*A1)
- x = (-C1 - B1*y) / A1
- if min(x1_1, x1_2) <= x <= max(x1_1, x1_2) and \
- min(y1_1, y1_2) <= y <= max(y1_1, y1_2):
- print('Да')
- else:
- print('Нет')
- else:
- print('Нет')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement