> questions, not on how a particular compiler in a particular environment prints
> numbers.
I think solving programming questions is most important too. But during the contest we receive some complains about the -0.0 and in fact -0.0 does not exist

Moderator: Board moderators
Yes, and that was because there was no special judge, which made it very hard to guess for which cases the output was supposed to be "-0.0" and for which it was supposed to be "0.0"sergio wrote:> I think programming problems should concentrate on solving programming
> questions, not on how a particular compiler in a particular environment prints
> numbers.
I think solving programming questions is most important too. But during the contest we receive some complains about the -0.0 and in fact -0.0 does not exist
Yes I get this right.sergio wrote:When we tested his program it failed in this input:
0.7 1.0 0.9 0.2 0.1 0.2
The answer should be:
The equidistant location is (0.5, 0.5).
Please do so~sergio wrote:I can also post more test cases if you want.
It is OK.Meng-Hsuan Wu wrote: When I decide whether two slopes are the same, I allow an error of 1e-14.
Code: Select all
24
0.0 1.0 0.0 3.0 1.0 2.0
0.0 -1.0 0.0 3.0 0.0 2.0
0.0 -1.0 0.0 -1.0 0.0 2.0
0.7 1.0 0.9 0.2 0.1 0.2
0.3 0.4 0.3 0.4 1.1 0.7
2.1 23.4 5.9 0.3 4.5 -2.0
1.0 0.0 0.2 0.8 0.1 0.9
8.2 -1.7 5.4 3.0 -4.0 15.1
7.2 3.5 5.2 9.3 0.7 8.2
-7.2 -3.4 6.3 9.7 -9.0 5.4
1.9 8.4 0.4 1.9 0.4 1.9
8.1 -0.2 0.5 1.9 2.3 2.4
6.0 4.3 2.9 0.1 -4.4 6.7
0.6 1.2 0.6 1.2 7.8 1.4
0.3 0.5 0.0 0.9 0.2 0.8
0.4 1.0 1.4 0.6 0.4 1.0
1.7 0.7 12.5 3.2 0.1 15.7
3.3 4.6 2.3 0.5 2.2 3.1
333.6 1.4 0.8 0.6 2.0 0.9
1.3 1.9 0.1 1.4 0.0 0.7
0.0 0.7 1.6 1.0 0.1 0.1
0.2 0.6 1.9 5.7 2.1 6.3
0.8 1.1 0.3 0.3 1.6 1.1
0.8 1.1 0.2 5.0 0.6 0.7
Code: Select all
The equidistant location is (0.0, 2.0).
There is no possible location.
There is an infinity of possible locations.
The equidistant location is (0.5, 0.5).
There is an infinity of possible locations.
The equidistant location is (-11.5, 9.3).
There is no possible location.
The equidistant location is (-65.7, -42.6).
The equidistant location is (3.7, 5.5).
The equidistant location is (0.0, 2.7).
There is an infinity of possible locations.
The equidistant location is (3.0, -3.7).
The equidistant location is (0.7, 5.0).
There is an infinity of possible locations.
The equidistant location is (-0.1, 0.6).
There is an infinity of possible locations.
The equidistant location is (5.5, 8.7).
The equidistant location is (5.4, 1.9).
The equidistant location is (168.8, -668.9).
The equidistant location is (1.0, 0.9).
The equidistant location is (0.9, 0.5).
There is no possible location.
The equidistant location is (1.2, 0.3).
The equidistant location is (-2.6, 2.6).
Code: Select all
if ( ( ( x - 0.05 ) < EPS ) && ( ( x + 0.05 ) > EPS ) )
x = 0.0 ;
else
{
if ( x < EPS )
x -= EPS ;
}