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

Обсуждение задачи 1294. Марсианские спутники

Why should I got WA2? It seems very easy to solve.
Послано z 27 май 2004 18:12
{$N+}
Program Mars_satellites;

 Var
   cos_,x,a,b,c,d:Double;

Begin
  Readln(a,b,c,d);
  If (a*b-c*d)=0 Then
  Begin
    Write('Impossible');
  End
  Else
  Begin
    cos_:=a*a+b*b-c*c-d*d;
    cos_:=cos_/(2*a*b-2*c*d);
    x:=a*a+b*b-2*a*b*cos_;
    x:=sqrt(x);
    x:=round(1000*x);
    Write('Distance is ',x:0:0,' km.');
  End;
End.
Re: Why should I got WA2? It seems very easy to solve.
Послано Danica Porobic 1 июн 2004 01:04
Hi,
your program has two mistakes, first one is (a*b-c*d)=0, equlity cannot be tested with doubles that way, you should use Abs(a*b-c*d)<e instead, where e is very small value, in this case e=0.01 is enough; second mistake is the formula I think, try to solve the math part of this problem again. If you want I can send you my AC program ( or just it's formula ).
HO-HO-HO
Послано vano_B1 8 июл 2004 16:15
...то выведите "Impossible.", иначе...
"Impossible{.}"
Re: Why should I got WA2? It seems very easy to solve.
Послано Gheorghe Stefan 28 июл 2004 18:42
who said the numbers were double? they are small integers...
And the formula is very good...
Re: Why should I got WA2? It seems very easy to solve.
Послано ivan 7 апр 2012 23:45
working formula =) nice