ENG  RUSTimus Online Judge
Online Judge
Задачи
Авторы
Соревнования
О системе
Часто задаваемые вопросы
Новости сайта
Форум
Ссылки
Архив задач
Отправить на проверку
Состояние проверки
Руководство
Регистрация
Исправить данные
Рейтинг авторов
Текущее соревнование
Расписание
Прошедшие соревнования
Правила
вернуться в форум

Обсуждение задачи 1341. Прибор

Test 15, something strange
Послано diver_ru (free) 19 сен 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
Послано bsu.mmf.team 3 мар 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
Послано Solver 3 авг 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
Послано Solver 4 авг 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)