The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
0 votes
186 views

Consider the line $y=\frac{n}{m}x$, where $n$ and $m$ are positive integers.

  1. If mq - np < 0, then is the point (p,q) above the line, below the line, or on the line?
  2. Complete the following function, that returns true if the line segment with endpoints (p,q) and (r,s) intersects the line $y=\frac{n}{m}x$, by writing the line number and the content of each box in your answer book.
  1: function clash (m, n, p, q, r, s: integer): Boolean;
  2: begin
  3: clash = false;
  4: if(m*q - n*p)⊏⊐ 0 then clash:= true;
  5: if(m*s - n*r)⊏⊐ 0 then clash:= true;
  6: if(m*q - n*p)⊏⊐ 0 and (m*s - n*r)⊏⊐ 0 then clash:= true;
  7: if(m*q - n*p)⊏⊐ 0 and (m*s - n*r)⊏⊐ 0 then clash:= true;
  8: end;
asked in Others by Veteran (59.6k points)
edited by | 186 views

Please log in or register to answer this question.

Related questions



Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

42,603 questions
48,602 answers
155,710 comments
63,754 users