ENG  RUSTimus Online Judge
Online Judge
Задачи
Авторы
Соревнования
О системе
Часто задаваемые вопросы
Новости сайта
Форум
Ссылки
Архив задач
Отправить на проверку
Состояние проверки
Руководство
Регистрация
Исправить данные
Рейтинг авторов
Текущее соревнование
Расписание
Прошедшие соревнования
Правила
вернуться в форум

Обсуждение задачи 1075. Нитка в пространстве

WA test #8. Help please.
Послано hidden_u 5 ноя 2005 00:00
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.
Послано Hatred 11 фев 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.
Послано Artem Khizha [DNU] 28 июл 2011 02:49
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.
Послано Artem Khizha [DNU] 28 июл 2011 03:54
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.
Послано TeamPMI-21 26 ноя 2012 02:07
Hi. Can you explain me, why this function of arccos is working correctly?) Because our program does not accepted without it.