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

Обсуждение задачи 1607. Такси

wa#4
Послано koyot 25 май 2008 20:39
here's my text:

program Project2;
var a,b,c,d:longint;
begin
 readln (a,b,c,d);

 while c>a do begin
a:=a+b;
c:=c-d;
  end;
if c=a+b then
   writeln (c)
else writeln (a);

end.


what's the problem??? help me please
Re: wa#4
Послано ACM.Krupko_Victor[Ivanovo SPU] 25 май 2008 22:03
4 3 6 1
correct answer: 6
Re: wa#4
Послано koyot 26 май 2008 14:16
thanks but now wa is #6 can't understand what ellse I've missed.
Re: wa#4
Послано ACM.Krupko_Victor[Ivanovo SPU] 26 май 2008 16:03
give me your code
Re: wa#4
Послано koyot 26 май 2008 17:07
program Project2;
var a,b,c,d:longint;
begin
 readln (a,b,c,d);
if c<a+b then
writeln (c)
else begin
 while c>a do begin
a:=a+b;
c:=c-d;
  end;
writeln (a);
end;

end.
Re: wa#4
Послано rohit 26 май 2008 18:05
If a>c in the beginning then answer is a not c.
Also check whether a>c after adding b each time.
Re: wa#4
Послано adilchib 16 мар 2009 13:48
correct answer is 7.
Re: wa#4
Послано Neo_OKTL 16 мар 2009 14:15
4 3 6 1
correct answer is 7
Re: wa#4
Послано Kiril Kafadarov - new 24 апр 2009 23:59
WHY???

Petr offers 4
Taxi says 6
Petr won't increase because 4+3>6 => the answer is 7
Re: wa#4
Послано Dj_Denis 9 ноя 2009 14:55
Here is correct code

var a,b,c,d:integer;
begin
Readln(a,b,c,d);
While a<=c do begin
a:=a+b;
if a>c then a:=c;
c:=c-d;
end;
Write(a);
end.

Edited by author 09.11.2009 14:56
Re: wa#4
Послано jambas92 18 сен 2011 17:24
correct answer is 6! Read the task carefully!!
Re: wa#4
Послано mr.sanatbek_94 22 мар 2015 16:59
No correct answer must be 6.
Because, Peter offer: 4 but when you add 3 it will be 7>6 in this case a must be equal 6. Beacause driver satisfy 6 money.
In this case put this condition to your iterator:
if(a>c) a=c;