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 1341. Device

Test 15, something strange
Posted by diver_ru (free) 19 Sep 2007 01:28
I send program with such procedure:

void moveNorth(double dist)
{
  w += dist / rEarth * 180 / pi;
  if (w > 91.0)
    n = (n - n) / n;
}

And got crash 15, but when i send

void moveNorth(double dist)
{
  w += dist / rEarth * 180 / pi;
}

i got accepted.

So, i think device can reach north pole with test 15 input data, but it's impossible.
Re: Test 15, something strange
Posted by bsu.mmf.team 3 Mar 2011 23:15
In this test the device flies too close to north pole.
I got AC instead WA#15 when I changed PI from 3.14159265 to 3.141592653589.
And I searched for a numerical mistake for 1 hour :) Ha-ha!

Edited by author 03.03.2011 23:16
Re: Test 15, something strange
Posted by Solver 3 Aug 2026 10:49
acos(-1) for the most precise value of PI, but still had WA15 with this code

    int rlat = (int)round(lat * 180 * 1000 / pi);
    int rlon = (int)round(lon * 180 * 1000 / pi);
    while (rlon <= -180 * 1000)
        rlon += 360 * 1000;
    while (rlon > 180 * 1000)
        rlon -= 360 * 1000;
    printf("%s%d.%.3d\n", rlat < 0 ? "-" : "", abs(rlat) / 1000, abs(rlat) % 1000);
    printf("%s%d.%.3d\n", rlon < 0 ? "-" : "", abs(rlon) / 1000, abs(rlon) % 1000);

Then got AC with this code

    lat *= 180 / pi;
    lon *= 180 / pi;
    while (lon <= -180)
        lon += 360;
    while (lon > 180)
        lon -= 360;
    printf("%.3lf\n%.3lf\n", lat, lon);

So I guess there is something like "-0.000" expected by checker

Edited by author 03.08.2026 11:20
Re: Test 15, something strange
Posted by Solver 4 Aug 2026 11:15
P.S: Checked with asserts for "-0.000" and "-180.000" results - it didn't fire. Maybe that stuff with 'round' is wrong way to do it with integers (I actually did that precisely to avoid fiddling with such outputs)