11692 - Rain Fall

All about problems in Volume 116. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

Post Reply
Jehad Uddin
Learning poster
Posts: 74
Joined: Fri May 08, 2009 5:16 pm

11692 - Rain Fall

Post 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;
}
hasan3050
New poster
Posts: 8
Joined: Wed Sep 09, 2009 2:46 am

Re: 11692 getting WA

Post 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:
Mohsin Reza Razib
New poster
Posts: 12
Joined: Fri Dec 15, 2006 12:57 pm
Location: Dhaka, Bangladesh
Contact:

11692 getting WA

Post by Mohsin Reza Razib »

sorry wrong place
Last edited by Mohsin Reza Razib on Sun Oct 11, 2009 2:45 pm, edited 1 time in total.
Mohsin Reza
"The tragedy of life does not lie in not reaching your goal. The tragedy lies in having no goal to reach".- Benajamin Mays
Bryton
New poster
Posts: 3
Joined: Mon Mar 14, 2016 6:12 pm

Re: 11692 - Rain Fall

Post by Bryton »

I am wondering if anyone can provide a hint about how to set up the problem as a quadratic equation.
Post Reply

Return to “Volume 116 (11600-11699)”