need help in a problem

Revision en3, by raj_aman, 2019-08-02 12:17:14

problem big money can anyone help me to find out the error in my solution,i have worked on all extreme points of range:

double l1,r1,p1,l2,r2,p2;

int main() { ll m;cin>>m; ll n;cin>>n; while(n--) { cin>>l1>>r1>>p1>>l2>>r2>>p2; double ans=0.0+m;

if(m>=l1&&m<=r1)
        {
            double ans2=m+p1*m/100;
            if(ans2-ans>0.000000000)ans=ans2;
        }
        if(m>=l2&&m<=r2)
        {
            double ans2=m+p2*m/100;
            if(ans2-ans>0.000000000)ans=ans2;
        }
        ll a=l1,b=m-l1;
        if(a>=0&&b>=0)
        {  double ans2;
            if(b>=l2&&b<=r2)
            {  ans2=a+b+p1*a/100+p2*b/100;


            }
            else ans2=a+b+p1*a/100;
            if(ans2-ans>0.000000000)ans=ans2;
        }
         a=r1,b=m-r1;
        if(a>=0&&b>=0)
        {  double ans2;
            if(b>=l2&&b<=r2)
            {  ans2=a+b+p1*a/100+p2*b/100;


            }
            else ans2=a+b+p1*a/100;
            if(ans2-ans>0.000000000)ans=ans2;
        }

         a=r2,b=m-r2;
        if(a>=0&&b>=0)
        {  double ans2;
            if(b>=l1&&b<=r1)
            {  ans2=a+b+p1*b/100+p2*a/100;


            }
            else ans2=a+b+p2*a/100;
            if(ans2-ans>0.000000000)ans=ans2;
        }

         a=l2,b=m-l2;
        if(a>=0&&b>=0)
        {  double ans2;
            if(b>=l1&&b<=r1)
            {  ans2=a+b+p2*a/100+p1*b/100;


            }
            else ans2=a+b+p2*a/100;
            if(ans2-ans>0.000000000)ans=ans2;
        }


       //cout<<setprecision(100000000)<<fixed;
       cout<<setprecision(12)<<fixed;
       cout<<ans<<endl;



   }


return 0;

}

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English raj_aman 2019-08-02 12:17:14 39
en2 English raj_aman 2019-08-02 10:37:20 2137
en1 English raj_aman 2019-08-02 10:35:32 4158 Initial revision (published)