-4
$\begingroup$

Given $M = [0,4,8,15]$ as points on a real line place 2 points $C_1$, $C_2$ on the line according to the following conditions

Both $C_1$ and $C_2$ cannot be placed at 0 or 15.

Distance between $C_1$ and $C_2$ should be $\leq$ $7$

Distance between first point in M (that is 0) and $C_1$ should be $\leq$ $7$

Distance between last point in M( that is 15) and $C_2$ should be $\leq$ $7$

The objective is to place points $C_1$ , $C_2$ in such a way that maximum number of points of $C_1$ , $C_2$ (which is 0 or 1 or 2) coincide with points in $M$

Solution : $C_1$ can be placed at $4$ and $C_2$ can be placed at $8$ so that maximum number of points i,e.,2 are placed so that they coincide with $M$ points and they satisfy all the conditions

$\endgroup$
4
  • 1
    $\begingroup$ There is already an answer in your question. $\endgroup$
    – Nathaniel
    Nov 18 at 22:08
  • $\begingroup$ I know but, could you provide the Python code that arrives at this solution? $\endgroup$ Nov 19 at 0:49
  • 1
    $\begingroup$ Have a (another) look at the info for tag python. $\endgroup$
    – greybeard
    Nov 19 at 8:36
  • 1
    $\begingroup$ An an exception, here is some python code that provides the solution print("C1 = 4; C2=8.") $\endgroup$
    – Steven
    Nov 19 at 9:13

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.