SHOI2012 信用卡凸包

传送门

顶点凸包+一个圆周长。

#include<bits/stdc++.h>
#define re register
#define cs const
cs int N=4e4+10;
cs double eps=1e-8,oo=1e9,pi=acos(-1);
struct Grid{
	double x,y;
	Grid(double X=0,double Y=0){x=X,y=Y;}
	inline double Angle(){return atan2(y,x);}
	inline double len(){return sqrt(x*x+y*y);}
	friend inline Grid operator +(const Grid &a,const Grid &b){return Grid(a.x+b.x,a.y+b.y);}
	friend inline Grid operator -(const Grid &a,const Grid &b){return Grid(a.x-b.x,a.y-b.y);}
	friend inline Grid operator *(const Grid &a,const double &b){return Grid(a.x*b,a.y*b);}
	friend inline Grid operator /(const Grid &a,const double &b){return Grid(a.x/b,a.y/b);}
	friend inline double dot(const Grid &a,const Grid &b){return a.x*b.x+a.y*b.y;}
	friend inline double cross(const Grid &a,const Grid &b){return a.x*b.y-a.y*b.x;}
	inline Grid rotate(double ang){return Grid(x*cos(ang)-y*sin(ang),x*sin(ang)+y*cos(ang));}
}A[N],S[N];
typedef Grid Point,Vector;
inline int sgn(double x){
	if(x>eps) return 1;
	if(x<-eps) return -1;
	return 0;
}

int n,tot,pos,top;double a,b,r,x,y,angle;
inline void get_pnts(cs Point &O,double ang){
	A[++tot]=Vector( b, a).rotate(ang)+O;
	if(A[0].y>A[tot].y||(A[0].y==A[tot].y&&A[0].x>A[tot].x)) A[0]=A[tot],pos=tot;
	A[++tot]=Vector(-b, a).rotate(ang)+O;
	if(A[0].y>A[tot].y||(A[0].y==A[tot].y&&A[0].x>A[tot].x)) A[0]=A[tot],pos=tot;
	A[++tot]=Vector( b,-a).rotate(ang)+O;
	if(A[0].y>A[tot].y||(A[0].y==A[tot].y&&A[0].x>A[tot].x)) A[0]=A[tot],pos=tot;
	A[++tot]=Vector(-b,-a).rotate(ang)+O;
	if(A[0].y>A[tot].y||(A[0].y==A[tot].y&&A[0].x>A[tot].x)) A[0]=A[tot],pos=tot;
}
inline bool cmp(cs Point &a,cs Point &b){
	double P=atan2(a.y-A[1].y,a.x-A[1].x);
	double Q=atan2(b.y-A[1].y,b.x-A[1].x);
	return (P!=Q)?P<Q:a.x<b.x;
}
inline void Graham(){
	std::swap(A[pos],A[1]),std::sort(A+2,A+tot+1,cmp);
	S[1]=A[1],S[top=2]=A[2];
	for(int re i=3;i<=tot;++i){
		while(top>=3&&(cross(A[i]-S[top-1],S[top]-S[top-1])>=0)) --top;
		S[++top]=A[i];
	}S[top+1]=A[1];
}
double ans=0;
int main(){
	scanf("%d%lf%lf%lf",&n,&a,&b,&r),a-=r*2,b-=r*2,a/=2.0,b/=2.0,A[0]=Point(oo,oo);
	for(int re i=1;i<=n;++i) scanf("%lf%lf%lf",&x,&y,&angle),get_pnts(Point(x,y),angle);
	Graham();
	for(int re i=1;i<=top;++i) ans+=(S[i+1]-S[i]).len();
	printf("%.2lf\n",ans+2.0*pi*r);
}
内容概要:本文围绕“基于数据驱动的 Koopman 算子的递归神经网络模型线性化,用于纳米定位系统的预测控制研究”展开,提出了一种结合Koopman算子理论与递归神经网络(RNN)的数据驱动建模方法,旨在对非线性纳米定位系统进行有效线性化建模,并实现高精度的模型预测控制(MPC)。该方法利用Koopman算子将非线性系统映射到高维线性空间,通过递归神经网络学习系统的动态演化规律,构建可解释性强、计算效率高的线性化模型,进而提升预测控制在复杂不确定性环境下的鲁棒性与跟踪精度。文中给出了完整的Matlab代码实现,涵盖数据预处理、网络训练、模型验证与MPC控制器设计等环节,具有较强的基于数据驱动的 Koopman 算子的递归神经网络模型线性化,用于纳米定位系统的预测控制研究(Matlab代码实现)可复现性和工程应用价值。; 适合人群:具备一定控制理论基础和Matlab编程能力的研究生、科研人员及自动化、精密仪器、机器人等方向的工程技术人员。; 使用场景及目标:①解决高精度纳米定位系统中非线性动态响应带来的控制难题;②实现复杂机电系统的数据驱动建模与预测控制一体化设计;③为非线性系统控制提供一种可替代传统机理建模的有效工具。; 阅读建议:建议结合提供的Matlab代码逐模块分析实现流程,重点关注Koopman观测矩阵构造、RNN网络结构设计与MPC控制器耦合机制,同时可通过替换实际系统数据进行迁移验证,深化对数据驱动控制方法的理解与应用能力。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值