I'm getting the right results for the code for the sample outputs, but the OJ is giving a TLE (3 seconds max).The questions is here.int main(){    double h,u,d,f;    while(scanf(%lf%lf%lf%lf,&h,&u,&d,&f)!=EOF)    {        //cin>>h;       // if(h==0)          //  break;        //cin>>u>>d>>f;        double fu=.01*f*u;        double used_fu=0;        int day=1;        double crossed=0;        int success=0;        while(1)        {            crossed+=(u-used_fu);            if(crossed>h)            {                success++;break;            }            crossed-=d;            if(crossed<0)                break;            used_fu+=fu;            day++;        }        if(success==0)            cout<<failure;        else            cout<<success;        cout<< on day <<day<<\n;    }    return 0;}
Optimizing code for UVAJ 573 The Snail
c++;programming challenge