ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1030. Titanic

Something interesting
Posted by Sandro 30 Jul 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...
Posted by Oberon (Yura Znovyak) 1 Feb 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
Posted by Gene JHZ 18 Jul 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
Posted by IgorKoval(from Pskov) 14 Sep 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
Posted by -XraY- 21 Mar 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