ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1607. Taxi

koyot wa#4 [11] // Problem 1607. Taxi 25 May 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
ACM.Krupko_Victor[Ivanovo SPU] Re: wa#4 [10] // Problem 1607. Taxi 25 May 2008 22:03
4 3 6 1
correct answer: 6
koyot Re: wa#4 [4] // Problem 1607. Taxi 26 May 2008 14:16
thanks but now wa is #6 can't understand what ellse I've missed.
ACM.Krupko_Victor[Ivanovo SPU] Re: wa#4 [3] // Problem 1607. Taxi 26 May 2008 16:03
give me your code
koyot Re: wa#4 [2] // Problem 1607. Taxi 26 May 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.
rohit Re: wa#4 // Problem 1607. Taxi 26 May 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.
Dj_Denis Re: wa#4 // Problem 1607. Taxi 9 Nov 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
adilchib Re: wa#4 [4] // Problem 1607. Taxi 16 Mar 2009 13:48
correct answer is 7.
Neo_OKTL Re: wa#4 [3] // Problem 1607. Taxi 16 Mar 2009 14:15
4 3 6 1
correct answer is 7
Kiril Kafadarov - new Re: wa#4 [1] // Problem 1607. Taxi 24 Apr 2009 23:59
WHY???

Petr offers 4
Taxi says 6
Petr won't increase because 4+3>6 => the answer is 7
jambas92 Re: wa#4 // Problem 1607. Taxi 18 Sep 2011 17:24
correct answer is 6! Read the task carefully!!
mr.sanatbek_94 Re: wa#4 // Problem 1607. Taxi 22 Mar 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;