Skip to content

Instantly share code, notes, and snippets.

@kg86
Created August 29, 2014 19:15
Show Gist options
  • Select an option

  • Save kg86/91014c7e9295b21e82c6 to your computer and use it in GitHub Desktop.

Select an option

Save kg86/91014c7e9295b21e82c6 to your computer and use it in GitHub Desktop.

Revisions

  1. kg86 created this gist Aug 29, 2014.
    11 changes: 11 additions & 0 deletions aoj0021
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    #! -*- coding: utf-8-unix -*-
    import math

    if __name__=='__main__':
    n = int(raw_input())
    for i in xrange(n):
    x1, y1, x2, y2, x3, y3, x4, y4 = map(float, raw_input().strip().split(' '))
    if math.fabs((y2 - y1) * (x4 - x3) - (y4 - y3) * (x2 - x1)) < 1e-10:
    print 'YES'
    else:
    print 'NO'