// ACM-ICPC国内予選2010 G. レーザー光の反射 #include #include #include using namespace std; typedef complex P; struct L { P p, q; L(P p, P q) : p(p), q(q) {} }; const double EPS = 1e-8; const double INF = 1e12; double dot(P a, P b) { return real(conj(a)*b); } double cross(P a, P b) { return imag(conj(a)*b); } double angle(P a, P b) { return arg(conj(a)*b); } P footPerp(L l, P p) { return l.p + (l.q-l.p)*(dot(l.q-l.p, p-l.p) / (abs(l.q-l.p)*abs(l.q-l.p))); } P lineShadow(L l, P p){ return 2.0*footPerp(l, p)-p; } bool ssIntersect(L a, L b){ if(abs(imag((a.q-a.p)/(b.q-b.p))) &agl, const vector &vl, const vector &idx, P s, P g){ for(int i=0;i &agl, const vector &vl, vector &idx, P s, P g){ check(agl, vl, idx, s, g); if(idx.size()==5) return ; for(int i=0;i &agl, const vector &vl, P s, P g){ double res = INF; for(int i=0;iEPS) nxt = g; int idx = -1; for(int j=0;j> n, n){ P s, g; vector vl; for(int i=0;i> px >> py >> qx >> qy; vl.push_back(L(P(px,py), P(qx,qy))); } int tx, ty, lx, ly; cin >> tx >> ty >> lx >> ly; s = P(tx, ty); g = P(lx, ly); vector idx; vector vd; dfs(vd, vl, idx, s, g); printf("%.4lf\n", calc(vd, vl, s,g)); } }