Page 1 of 1

11692 - Rain Fall

Posted: Sat Oct 10, 2009 10:04 am
by Jehad Uddin
Hello every one ,i am getting WA in this problem,pls help, here is my code,

Code: Select all

#include<iostream>
#include<math.h>
#define eps 0.0000001
using namespace std;


double L,K,T1,T2,H;






int main()
{
 
 int ts,p,i,fnd;
 double l,u,t,l1,u1,t1,rt,rs;
 
 while(cin>>ts)
 {
  for(p=1;p<=ts;p++)
  {
   cin>>L>>K>>T1>>T2>>H;
   
   l=0,u=10000;
   l1=0,u1=T1;
   
   if(H<L&&K<(L/T1)) printf("%.6lf %.6lf\n",H,H);
   else
   {
       fnd=0;
       for(i=0;i<5000;i++)
   {
   t1=(l1+u1)/2;
   rt=L/t1;
   rs=T1+T2-t1;
   if(fabs(L+rt*(T1-t1)-rs*K-H)<eps) {fnd=1;break;}
   else if(L+rt*(T1-t1)-rs*K>H) l1=t1;
   else u1=t1;
   
   
   
  
   }
    
  
  
 if(fnd)   printf("%.6lf %.6lf\n",H,L+rt*(T1-t1));
  else  printf("%.6lf %.6lf\n",H,H);
   }
  }
  
 
 }
  

 return 0;
}

Re: 11692 getting WA

Posted: Sat Oct 10, 2009 12:08 pm
by hasan3050
try this case......

Code: Select all

80.00 0.50 2.00 1.50 81.00
ur code shows 81.000000 81.771666
but the ans will be 81.771666 81.771666............. :wink:

i think u got the point........ :wink:

11692 getting WA

Posted: Sun Oct 11, 2009 1:08 pm
by Mohsin Reza Razib
sorry wrong place

Re: 11692 - Rain Fall

Posted: Wed Apr 06, 2016 4:49 am
by Bryton
I am wondering if anyone can provide a hint about how to set up the problem as a quadratic equation.