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

Обсуждение задачи 1484. Кинорейтинг

WA11
Послано svr 8 окт 2006 14:55
Let S=maximal posible sum of points
Then S=max{S:S/N<x+0.05},S=min(S,10*N);
with multiplying by 100 we have the problem in integers
If L is an answer then L=min(L:(S+L)/(N+L)<y+0.05);
After multiplying by 100 we againg work in integers. But WA11

Edited by author 08.10.2006 14:56
Re: WA11
Послано serggl 9 окт 2006 00:50
That's the point?
The same algo, but WA 12:
var
  X, Y, s: extended;
  N, M: integer;
  SI: Integer;

begin
  read(X, Y, N);

  if X <> 10.0 then
    X := X + 0.05;

  Y := Y + 0.05;

  if (X = Y) or (X < Y) then
    writeln('0')
  else begin
    s := n * X;
    SI := trunc(s);
    M := trunc((SI - N * Y) / (Y - 1));

    while ((M + SI) / (M + N)) >= Y do
      inc(M);

    writeln(M);
  end;
end.
Re: WA11
Послано svr 9 окт 2006 11:57
Thank for an answer!
But now I have AC(0.015) with help of test 4.6 1.2 12997
Mistake were in convertion XX=X*100 from double to int and
instead of 460 I had XX=359 because X=4.59999999.
I inprove my algorithm by an operator XX=(X+0.000001)*100
but lost previously 1 day for debugging right program.
About yor code my advice is convert all problem to int type
first of all. Also it's important to know that we must use sign < but not<= then we roundind down after adding 0.05
Re: WA11
Послано Daniel 10 окт 2006 17:39
4.6 1.2 12997
What is the right answer?
Re: WA11
Послано Nechaev Ilya (Rybinsk SAAT) 10 окт 2006 18:13
I get AC (0.015) using dichotomy, and 0.0499999999999 instead of 0.05.

(X+0.05) rounded to 1 digit after decimal point is equal to X+0.1, but
(X+0.0499999999999) rounded to 1 digit after decimal point is equal to X.

Edited by author 10.10.2006 18:20

Edited by author 10.10.2006 18:21

Edited by author 10.10.2006 18:21