Advertisement
Guest User

Untitled

a guest
Jul 21st, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.70 KB | None | 0 0
  1. class Vector:
  2.     def __init__(self, x, y):
  3.         self.x = x
  4.         self.y = y
  5.  
  6.  
  7. def cross(v1, v2):
  8.     return v1.x * v2.y - v2.x * v1.y
  9.  
  10.  
  11. def main():
  12.     Ax, Ay = map(int, input().split())
  13.     Ox, Oy = map(int, input().split())
  14.     Bx, By = map(int, input().split())
  15.     Px, Py = map(int, input().split())
  16.  
  17.     OP = Vector(Px - Ox, Py - Oy)
  18.     OA = Vector(Ax - Ox, Ay - Oy)
  19.     OB = Vector(Bx - Ox, By - Oy)
  20.  
  21.     if cross(OB, OA) < 0:
  22.         if cross(OA, OP) >= 0 and cross(OP, OB) >= 0:
  23.             print('YES')
  24.         else:
  25.             print('NO')
  26.     else:
  27.         if cross(OB, OP) >= 0 and cross(OP, OA) >= 0:
  28.             print('YES')
  29.         else:
  30.             print('NO')
  31. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement