Advertisement
popov-aa

Solution2.java

Oct 13th, 2019
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.35 KB | None | 0 0
  1.     boolean isOneLine(int p, int p1, int p2, int[][] points){
  2.         int x = points[p][0];
  3.         int y = points[p][1];
  4.         int x1 = points[p1][0];
  5.         int y1 = points[p1][1];
  6.         int x2 = points[p2][0];
  7.         int y2 = points[p2][1];
  8.         long r = (y - y1)*(x2 - x1);
  9.         long l = (y2 - y1)*(x - x1);
  10.         return r == l;
  11.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement