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;
}