[SHOI2012]信用卡凸包(凸包+直觉)


这个题还是比较有趣。
小心发现,大胆猜想,不用证明!
我们发现所谓的信用卡凸包上弧的长度总和就是圆的周长!
然后再加上每个长宽都减去圆的直径之后的长方形的凸包周长即可!

#include
#include
#include
#include
#include
using namespace std;
const int N=40100;
const double eps=1e-12;
int stack[N],top,n;
double a,b,r,ans;
struct node{
	double x,y;
	node(double xx=0,double yy=0){
		x=xx;y=yy;
	}
}c[N];
node work(node a,double x){
	double A=cos(x),B=sin(x);
	return node(a.x*A-a.y*B,a.x*B+a.y*A);
}
bool cmp(node a,node b){
	if(a.x==b.x)return a.y=2&&chaji(c[stack[top]]-c[stack[top-1]],c[i]-c[stack[top]])+eps<0)top--;
		stack[++top]=i;
	}
	for(int i=1;i=1;i--){
		if(top<=1){stack[++top]=i;continue;}
		while(top>=2&&chaji(c[stack[top]]-c[stack[top-1]],c[i]-c[stack[top]])+eps<0)top--;
		stack[++top]=i;
	}
	for(int i=1;i