在两个传送带上分别三分两个点计算 三分套三分
# include <bits/stdc++.h>
# define IL inline
# define RG register
# define Fill(a, b) memset(a, b, sizeof(a))
# define Sqr(x) ((x) * (x))
using namespace std;
typedef long long ll;
const double EPS(1e-6), Div(0.382);
IL ll Read(){
RG char c = getchar(); RG ll x = 0, z = 1;
for(; c < '0' || c > '9'; c = getchar()) z = c == '-' ? -1 : 1;
for(; c >= '0' && c <= '9'; c = getchar()) x = (x << 1) + (x << 3) + (c ^ 48);
return x * z;
}
double ax, ay, bx, by, cx, cy, dx, dy, p, q, r;
IL double Dis(RG double x1, RG double y1, RG double x2, RG double y2){
RG double t1 = sqrt(Sqr(ax - x1) + Sqr(ay - y1)) / p;
RG double t2 = sqrt(Sqr(x1 - x2) + Sqr(y1 - y2)) / r;
RG double t3 = sqrt(Sqr(x2 - dx) + Sqr(y2 - dy)) / q;
return t1 + t2 + t3;
}
IL double Calc(RG double x, RG double y){
RG double x1 = cx, y1 = cy, x2 = dx, y2 = dy;
while(fabs(x2 - x1) > EPS || fabs(y2 - y1) > EPS){
RG double D1 = (x2 - x1) * Div, xmidl = x1 + D1, xmidr = x2 - D1;
RG double D2 = (y2 - y1) * Div, ymidl = y1 + D2, ymidr = y2 - D2;
RG double t1 = Dis(x, y, xmidl, ymidl), t2 = Dis(x, y, xmidr, ymidr);
if(t1 < t2) x2 = xmidr, y2 = ymidr;
else x1 = xmidl, y1 = ymidl;
}
return Dis(x, y, x1, y1);
}
int main(RG int argc, RG char* argv[]){
ax = Read(); ay = Read(); bx = Read(); by = Read();
cx = Read(); cy = Read(); dx = Read(); dy = Read();
p = Read(); q = Read(); r = Read();
RG double x1 = ax, y1 = ay, x2 = bx, y2 = by;
while(fabs(x2 - x1) > EPS || fabs(y2 - y1) > EPS){
RG double D1 = (x2 - x1) * Div, xmidl = x1 + D1, xmidr = x2 - D1;
RG double D2 = (y2 - y1) * Div, ymidl = y1 + D2, ymidr = y2 - D2;
RG double t1 = Calc(xmidl, ymidl), t2 = Calc(xmidr, ymidr);
if(t1 < t2) x2 = xmidr, y2 = ymidr;
else x1 = xmidl, y1 = ymidl;
}
printf("%.2lf
", Calc(x1, y1));
return 0;
}