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

Wa#14...Please help.Here is code:
Posted by Search 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!!!
*
Posted by Брэнд 8 Mar 2008 00:39
For test "1 4 10 2" right answer is 8.
Re: *
Posted by Plamen_Iliev 5 Apr 2008 19:45
why is it 8 ????
Re: *
Posted by haoranlin 13 Mar 2009 10:42
why is it 8?
Re: *
Posted by Maxim Dvoynishnikov (Dnipropetrovsk SU) 14 Mar 2009 02:39
>> 1
<< 10
>> 5
<< 8
>> 9, but 8