Given 5 points inside a square of side 10 cm, what is the probability that
at least two of the points are within 8cm of each other?
(In reply to
computer soln by Steven Lord)
Based on charlies observations I went back and had a second look at this problem and now agree that it is impossible as the most spread you can make 4 points is by placing them at the 4 corners, however even this configuration does not leave room for a 5th point without causing a pair to be within 8cm.
With that being said, your code seemed to contradict this so either our thinking was wrong or your code was. In that regard I think I found the bug in your code and it is in the part where you check if d>=64, after that if statement you then check if flag=1 which only happens once a d>=64 is found. The problem is you only skip to 2 (thus avoiding incrementing cntng) the second time one of these are found. So if there is only 1 pair of points that are within 8cm then you will still end up counting them. Perhaps I am wrong, I think the best proof would be if you could have it output some examples of points that it considers valid.
|
Posted by Daniel
on 2019-08-05 22:23:45 |