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

Обсуждение задачи 1030. Титаник

Something interesting
Послано Sandro 30 июл 2004 00:07
My program had WA Test#7. Last two lines were:
    printf("The distance to the iceberg: %.2lf miles.\n",ans);
    if (ans<99.999) printf("DANGER!");
But when I changed only the last one:
    if (ans<99.995) printf("DANGER!");
I got AC!

(Now I think, that I should compare with 100 miles not answer, but it with two digits: so 99.996 is 100.00, but 99.994 is 99.99.)
Yep! We should compare only 2 digits of answer...
Послано Oberon (Yura Znovyak) 1 фев 2005 17:52
Yes you are right!
I have had same problem.
It would be better with few clarifications in the problem descriptions...

Edited by author 01.02.2005 17:53
Re: Something interesting
Послано Gene JHZ 18 июл 2006 20:12
Thank you for the hint.
I'll never think of that!

Edited by author 18.07.2006 20:12
Re: Something interesting
Послано IgorKoval(from Pskov) 14 сен 2011 21:21
You is good man!
ver. #2 =)
double round( double d ) {//окр. до двух знаков
    d *= 100;
    if( long(d*10)%10>=5 ) ++d;
    return (double(long(d)))/100;
}

ans = round( ans );
printf( "The distance to the iceberg: %.2lf miles.\n", ans );
if( ans < 100/*!!!*/ ) puts( "DANGER!" );
ver. #3 =)
    ans = floor( ans*100 + 0.5 )/100;
    printf( "The distance to the iceberg: %.2lf miles.\n", ans );
    if( ans < 100 ) puts( "DANGER!" );

Edited by author 14.09.2011 22:30
Re: Something interesting
Послано -XraY- 21 мар 2013 19:36
I wrote the problem for the second time, but also couldn't understand that.(
It needs clarification.

Edited by author 21.03.2013 19:37