凸轮

[CERC2016]凸轮廓线

余生颓废 提交于 2019-11-28 13:37:32
题意 https://www.luogu.org/problem/P3680 思考 拆点即可。 注意精度。 代码 1 // luogu-judger-enable-o2 2 #include<bits/stdc++.h> 3 using namespace std; 4 typedef long double ld; 5 const ld eps=1E-16; 6 const ld pi=acos(-1); 7 const ld inf=1E9; 8 inline bool equal(ld x,ld y) 9 { 10 return abs(x-y)<=eps; 11 } 12 struct pt 13 { 14 ld x,y; 15 pt(ld a=0,ld b=0){x=a,y=b;} 16 pt operator+(const pt&A){return pt(x+A.x,y+A.y);} 17 pt operator-(const pt&A){return pt(x-A.x,y-A.y);} 18 pt operator*(ld d){return pt(x*d,y*d);} 19 pt operator/(ld d){return pt(x/d,y/d);} 20 ld operator*(const pt&A){return x*A.y-y*A.x;} 21 void