# Uyuw's Concert POJ2451

2022年11月23日
0 收藏 327 点赞 4,118 浏览 2112 个字

` const     maxn=;     eps=1e-7; type     point=record       x,y:double;     end;     poly=record       x,y,w:point;     end; var     a:array[..maxn]of poly;     n:longint; operator -(a,b:point)c:point; begin     c.x:=a.x-b.x;     c.y:=a.y-b.y; end; operator +(a,b:point)c:point; begin     c.x:=a.x+b.x;     c.y:=a.y+b.y; end; operator *(a:point;b:double)c:point; begin     c.x:=a.x*b;     c.y:=a.y*b; end; operator *(a,b:point)c:double; begin     c:=a.x*b.y-a.y*b.x; end; function wh(a:point):longint; begin     with a do       begin         if abs(x)<eps then           if y>eps then exit()           else exit()         else           if abs(y)<eps then             if x>eps then exit()             else exit()           else             if x>eps then               if y>eps then exit()               else exit()             else               if y>eps then exit()               else exit();       end; end; procedure swap(var x,y:poly); var     t:poly; begin     t:=x;x:=y;y:=t; end; procedure sort(l,r:longint); var     i,j:longint;     y:point; begin     i:=l;     j:=r;     y:=a[(l+r)>>].w;     repeat       while (wh(a[i].w)<wh(y)) or ((wh(a[i].w)=wh(y)) and (y*a[i].w+eps<)) do         inc(i);       while (wh(a[j].w)>wh(y)) or ((wh(a[j].w)=wh(y)) and (y*a[j].w>eps)) do         dec(j);       if i<=j then       begin         swap(a[i],a[j]);         inc(i);         dec(j);       end;     until i>j;     if i<r then sort(i,r);     if j>l then sort(l,j); end; procedure init; var     i:longint; begin     read(n);     for i:= to n do       with a[i] do         begin           read(x.x,x.y,y.x,y.y);           w:=y-x;         end;     a[n+].x.x:=;     a[n+].x.x:=;     a[n+].x.y:=;     a[n+].x.y:=;     for i:= to  do       begin         a[n+i+].y:=a[n+((i+)mod )+].x;         a[n+i+].w:=a[n+i+].y-a[n+i+].x;       end;     inc(n,);     sort(,n); end; function get(a,b:poly):point; var     s1,s2:double; begin     s1:=a.w*(b.y-a.x);     s2:=a.w*(b.x-a.x);     if s1*s2>eps then s1:=-s1     else       begin         s1:=abs(s1);         s2:=abs(s2);       end;     if abs(s1+s2)<eps then get:=b.x     else get:=b.x+(b.w*(s2/(s1+s2))); end; var     q:array[..maxn]of poly;     d:array[..maxn]of point;     l,r:longint;     ans:double; procedure work; var     i:longint; begin     l:=;     r:=;     q[]:=a[];     for i:= to n do       begin         while (l<r) and (a[i].w*(d[r-]-a[i].x)+eps<) do           dec(r);         while (l<r) and (a[i].w*(d[l]-a[i].x)+eps<) do           inc(l);         inc(r);         q[r]:=a[i];         if abs(q[r-].w*q[r].w)<eps then         begin           dec(r);           if a[i].w*(q[r].x-a[i].x)< then q[r]:=a[i];         end;         d[r-]:=get(q[r],q[r-]);       end;     while (l<r) and (q[l].w*(d[r-]-q[l].x)+eps<) do       dec(r);     if l<r then d[r]:=get(q[l],q[r]);     if r-l<= then writeln('0.0')     else       begin         for i:=l to r- do           ans:=ans+(d[i]*d[i+])/;         ans:=ans+(d[r]*d[l])/;         ans:=abs(ans);         if ans<eps then writeln('0.0')         else writeln(ans::);       end; end; begin     init;     work; end.`

python开发_常用的python模块及安装方法

Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接：http://www.codeforces.com/contest/660/problem/CDes…

zengkefu@server1:/usr/src\$ uname -aLinux server1 4.10.0-19-generic #21…

Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式，并且由于涉及到要把拍到的照片显…

Struts的使用