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

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.

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);
            }
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.