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

Could you give me some tests , Got WA#13
Posted by Rustambek_UWED 25 Apr 2008 20:20
Please help me I got WA test13
I had done everything plz help.
Thank you beforehand.


//1607. Taxi
#include <iostream>
using namespace std;
int main()
{
    int a,b,c,d,i,m;
    cin>>a>>b>>c>>d;
    if(a>=c)
        cout<<a<<endl;
    else
    {
        if(b<d)
            m=b;
        else
            m=d;
        for(i=1;c-d*(i-1)-a-b*i>m;i++);
        if(c-d*(i-1)-a-b*i>=0)
            cout<<a+b*i<<endl;
        else
            cout<<c-d*(i-1)<<endl;
    }
    return 0;
}