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

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

Why Compilation Error?!
Послано Pisnyachevsky Nikolai 7 апр 2006 14:16
In my C++ compiler options I determined the highest level of compilation and set the checkbox "Warnings as errors". On my computer this programm is working out fine without any warnings? But on server it always gets CE. Why?

#include <iostream.h>
#include <math.h>
int main()
{
    int AD,AC,BD,BC;
    double x, _x;
    cin >> AD >> AC >> BD >> BC;
    if (fabs(AD*AC - BD*BC) < 0.001)
    {
        cout << "Impossible.";
    }
    else
    {
        double cos_ = (double)(AD*AD + AC*AC - BD*BD - BC*BC) / (double)(2*AD*AC - 2*BD*BC);
        x = sqrt(AD*AD + AC*AC - 2*AD*AC*cos_) * 1000;
        _x = floor(x);
        if (fabs(x - _x) > 0.5)
        {
            x = ceil(x);
        }
        else
        {
            x = _x;
        }
        cout << "Distance is " << x << " km.";
    }
    return 0;
}
Read FAQ. You should use "To My Email Address" option when submitting (+)
Послано Michael Rybak (accepted@ukr.net) 7 апр 2006 19:40
Here's an email I received after submitting your code as solution for problem 1000:

Dear Michael Rybak (accepted@ukr.net),

You tried to solve problem 1000 A+B Problem.
Your solution was compiled with the following errors:

c5edc0d2-ca53-4c5a-b65d-18f889e279bd
c5edc0d2-ca53-4c5a-b65d-18f889e279bd(8): error: more than one instance of overloaded function "fabs" matches the argument list:
           function "fabs(double)"
           function "fabs(float)"
           function "fabs(long double)"
           argument types are: (int)
 if (fabs(AD*AC - BD*BC) < 0.001)
     ^

c5edc0d2-ca53-4c5a-b65d-18f889e279bd(28): warning #1: last line of file ends without a newline
 }
  ^

compilation aborted for c5edc0d2-ca53-4c5a-b65d-18f889e279bd (code 2)

Timus Online Judge
http://acm.timus.ru
Also, you can download MinGW or Cygwin (+)
Послано Michael Rybak (accepted@ukr.net) 7 апр 2006 19:44
For example, go to http://www.mingw.org/download.shtml and download the following files (these are enough for sure):

binutils-2.16.91-20060119-1.tar.gz
gcc-core-3.4.5-20060117-1.tar.gz
gcc-g++-3.4.5-20060117-1.tar.gz
mingw-runtime-3.9.tar.gz
w32api-3.6.tar.gz

Extract them all in same folder; no special installation is required. Now use g++.exe for compiling:

g++ program program.cpp
Re: Also, you can download MinGW or Cygwin (+)
Послано Pisnyachevsky Nikolai 7 апр 2006 23:27
Thank You!