|
|
back to boardCould anyone help me please, WA on test #4 ? Hi, all. My program is generating all possible lines [ so they are only less or equal to C(n,2) lines were kept ]. I keep 'M' and 'C' of every line, sort them and then count the most appeared lines. When I count the most appeared lines, I multiplied it by 2, take sqrt and ceil it up. Like this : ans = (int) ceil(sqrt(2.0* max)); Above is from C(n,2) = maxline I use the formular c = (x1 y2 - x2 y1) / x1-x2 After I received WA#4 the first time, I changed all my code to keep M and C in fraction [ didn't divide it but keep 2 values ] to avoid error from floating point. I still get WA on test #4. Could anyone give me test case #4 to me, or some of test cases which might help me please? Thank you all in advance and sorry for my poor English ;-) Re: Could anyone help me please, WA on test #4 ? Posted by Madhav 15 Jun 2008 14:57 don't try to use the concept of slope.Try to use the idea that if 3 points are collinear the area of triangle formed by those points is 0.Then u can avoid fractions.Note even that double values cannot be compared exactly which lead to WA.So try use the above idea |
|
|