ENG  RUS Timus Online Judge
Online Judge
Problems
Authors
Online contests
Site news
Webboard
Problem set
Submit solution
Judge status
Guide
Register
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

## Discussion of Problem 1030. Titanic

Help WA Test #7
Posted by Varun Sharma 4 May 2009 15:22

Edited by author 07.03.2010 10:26
Re: Help WA Test #7
Posted by Varun Sharma 4 May 2009 16:42
Hi,

Alright guys I have solved the problem. Being a newbie to c# caused me to submit program 35 times. I didn't realize that Math.Round() function will change 100.00 to 100 instead. Here are the lines which I changed.

if (Math.Round(miles, 2) < 100.00)
{
Console.WriteLine("The distance to the iceberg: {0:F2} miles.", miles);
Console.WriteLine("DANGER!");
}
else
{
Console.WriteLine("The distance to the iceberg: {0:F2} miles.", miles);
}
Re: Help WA Test #7
Posted by r1d1 17 Aug 2009 20:02
s=floor(s*100+0.5)/100.0
Re: Help WA Test #7
Posted by Cebotari Vladislav 6 Jan 2017 15:17
Solved by making the following comparison in java:

if (Math.round(distance*100) < 10000) {
System.out.println("DANGER!");
}

it will force it to compare with 2 digits precision.