Three points.
Three points AB on the point, repeatedly points on the CD can be (visual but I too weak will not permit, later will prove the process of supplementary proof).
Note that line segments degenerate into dots, so it's best not to count the answers at three points (where the pit Qaq)
#include <cmath> #include <cstdio> #include <algorithm> using namespace std;
const double eps=1e-3;
Double ax,ay,bx,by,cx,cy,dx,dy,p,q,r; Double dis (double x1,double y1,double x2,double y2) {return sqrt ((x1-x2) * (X1-X2) + (y1-y2) * (Y1-y2));} Double tri (doubl
e x, double y) {double lx=cx,ly=cy,rx=dx,ry=dy,mx1,my1,mx2,my2,r1,r2;
while (ABS (LX-RX) >eps | | ABS (LY-RY) >eps) {mx1=lx+ (RX-LX)/3;mx2=lx+2* (RX-LX)/3;
my1=ly+ (ry-ly)/3;my2=ly+2* (ry-ly)/3;
R1=dis (x,y,mx1,my1)/r+dis (mx1,my1,dx,dy)/q;
R2=dis (x,y,mx2,my2)/r+dis (mx2,my2,dx,dy)/q;
if (R1>R2) lx=mx1,ly=my1;
else Rx=mx2,ry=my2;
return dis (x,y,lx,ly)/r+dis (lx,ly,dx,dy)/q; int main () {scanf ("%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf", &ax,&ay,&bx,&by,&cx,&cy,&dx,&
AMP;DY,&P,&Q,&R);
Double lx=ax,ly=ay,rx=bx,ry=by,mx1,my1,mx2,my2,r1,r2; while (ABS (LX-RX) >eps | | ABS (LY-RY) >eps) {mx1=lx+ (RX-LX)/3;mx2=lx+2* (RX-LX)/3;
my1=ly+ (ry-ly)/3;my2=ly+2* (ry-ly)/3;
R1=tri (mx1,my1) +dis (ax,ay,mx1,my1)/p;
R2=tri (mx2,my2) +dis (ax,ay,mx2,my2)/p;
if (R1>R2) lx=mx1,ly=my1;
else Rx=mx2,ry=my2;
printf ("%.2lf\n", Tri (lx,ly) +dis (ax,ay,lx,ly)/p); }