|
|
back to boardWA test #8. Help please. What is wrong with my code? I can't figure out by myself:( Some people talking about some tricky case. What is it? Re: WA test #8. Help please. Posted by Hatred 11 Feb 2010 23:41 Check your code for the extreme cases. -1000 -1000 -1000 1000 1000 1000 0 0 0 0 I've found that sqrt returns NaN for values below 1e-8 (approximately). Re: WA test #8. Help please. Your test is incorrect, because R must be a positive integer. > I've found that sqrt returns NaN for values below 1e-8 (approximately). I cannot know what compiler you use, but in my GCC (and judge's MSVC) there is several functions for finding a square root: ___ float sqrtf(float); ___ double sqrt(double); ___ long double sqrtl(long double); and the last two compute a proper value for 1e-8. Edited by author 28.07.2011 02:49 Re: WA test #8. Help please. Well, I solved a mysterious case of WA #8. :-) Just checked every double variable whether it is NaN. I had a working program, but get WA only because of acos function. When I had started to use something like this instead of acos: > double arccos(double x) { > x = min(1.0d, max(-1.0d, x)); > return acos(x); > } I got AC. Re: WA test #8. Help please. Hi. Can you explain me, why this function of arccos is working correctly?) Because our program does not accepted without it. |
|
|