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

Varun Sharma Help WA Test #7 [3] // Problem 1030. Titanic 4 May 2009 15:22


Edited by author 07.03.2010 10:26
Varun Sharma Re: Help WA Test #7 // Problem 1030. Titanic 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.

double miles = distance(ship_latitude_radian, ship_longitude_radian, iceberg_latitude_radian, iceberg_longitude_radian);
            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);
            }
r1d1 Re: Help WA Test #7 // Problem 1030. Titanic 17 Aug 2009 20:02
s=floor(s*100+0.5)/100.0
Cebotari Vladislav Re: Help WA Test #7 // Problem 1030. Titanic 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.