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

Search Wa#14...Please help.Here is code: [4] // Problem 1607. Taxi 7 Mar 2008 20:22
#include<iostream.h>
#include<math.h>
int main()
{
    int a1,b1,a2,b2;
    cin>>a1>>b1>>a2>>b2;
if(a2<=a1)
cout<<a1;
else
if(abs(a1-a2)<b1)
cout<<a2;
else{
    while(a1<a2)
    {
        a1+=b1;
    a2-=b2;
}
if(a1>a2)
cout<<a1;
else
cout<<a2;
}
return 0;
}
Where I'm wrong?Please help!Thank in advance!!!
Брэнд * [3] // Problem 1607. Taxi 8 Mar 2008 00:39
For test "1 4 10 2" right answer is 8.
Plamen_Iliev Re: * // Problem 1607. Taxi 5 Apr 2008 19:45
why is it 8 ????
haoranlin Re: * [1] // Problem 1607. Taxi 13 Mar 2009 10:42
why is it 8?
Maxim Dvoynishnikov (Dnipropetrovsk SU) Re: * // Problem 1607. Taxi 14 Mar 2009 02:39
>> 1
<< 10
>> 5
<< 8
>> 9, but 8