Linear equation problem

Revision en2, by time_heals_nothing, 2019-09-01 08:09:11

I have $$$n$$$ lines in the form: $$$y_i=a_i x+b_i$$$, where $$$1\leq n \leq 10^6$$$ and $$$-10^9 \leq a, b \leq 10^9$$$. I need to know how many different lines has the maximum value at some $$$x$$$ (possible $$$x=0$$$).

For example:

$$$y_1 = 3x+20$$$
$$$y_2 = 2x+20$$$
$$$y_3 = 20x+19$$$

At $$$x=0$$$, the lines $$$y_1$$$ and $$$y_2$$$ has the maximum value ($$$20$$$) for that $$$x$$$, but in $$$x=1$$$ just the line $$$y_3$$$ has the maximum value ($$$39$$$), so the answer is 3, because all of them has the maximum value for some $$$x$$$. How can I implement that?

Thanks in advance

Tags #geometry, #math

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English time_heals_nothing 2019-09-01 08:09:11 12
en1 English time_heals_nothing 2019-09-01 08:00:51 564 Initial revision (published)