poj 1113 凸包
#include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <queue> #include <map> #include <vector> #include <set> #include <string> #include <cmath> using namespace std; ; const double PI=acos(-1.0); ,):x(x),y(y) {}; }; typedef Point Vector; Vector operator - (Point A, Point B){ return Vector(A.x-B.x, A.y-B.y); } // 向量生成 double dis(Point A,Point B) { return sqrt( (A.x-B.x)*(A.x-B.x)+(A.y-B.y)*(A.y-B.y) ); } double Cross(Vector B, Vector A) { return A.x*B.y-A.y*B.x; } // 叉积 Point pa[maxn]; Point pt[maxn]; bool up(Point a,Point b) { if(a.x!=b.x) return a.x<b.x; return a.y<b.y; } int main() { int n,r; scanf("%d %d",&n,&r); ;i<n;i++) scanf("%lf %lf",&pa[i].x,&pa[i].y); sort(pa,pa+n,up); ; ;i<n;i++) { && Cross(pt[m-]-pt[m-],pa[i]-pt[m-])<=) m--; pt[m++]=pa[i]; } int k=m; ;i>=;i--) { ]-pt[m-],pa[i]-pt[m-])<=) m--; pt[m++]=pa[i]; } ) m--; ; ;i<m;i++) ans+=dis(pt[i],pt[i+]); ans+=dis(pt[m],pt[]); //cout<<ans<<" "<<PI<<endl; ans+=PI*r*; printf("%.0f\n",ans); ; }
poj 1113 凸包的更多相关文章
- poj 1113 凸包周长
Wall Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 33888 Accepted: 11544 Descriptio ...
- POJ 1113 凸包模板题
上模板. #include <cstdio> #include <cstring> #include <iostream> #include <algorit ...
- 计算几何--求凸包模板--Graham算法--poj 1113
Wall Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 28157 Accepted: 9401 Description ...
- POJ 1113 Wall 凸包 裸
LINK 题意:给出一个简单几何,问与其边距离长为L的几何图形的周长. 思路:求一个几何图形的最小外接几何,就是求凸包,距离为L相当于再多增加上一个圆的周长(因为只有四个角).看了黑书使用graham ...
- poj 1113 Wall 凸包的应用
题目链接:poj 1113 单调链凸包小结 题解:本题用到的依然是凸包来求,最短的周长,只是多加了一个圆的长度而已,套用模板,就能搞定: AC代码: #include<iostream> ...
- poj 1873 凸包+枚举
The Fortified Forest Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 6198 Accepted: 1 ...
- Poj 2187 凸包模板求解
Poj 2187 凸包模板求解 传送门 由于整个点数是50000,而求凸包后的点也不会很多,因此直接套凸包之后两重循环即可求解 #include <queue> #include < ...
- POJ 1113 Wall(凸包)
[题目链接] http://poj.org/problem?id=1113 [题目大意] 给出一个城堡,要求求出距城堡距离大于L的地方建围墙将城堡围起来求所要围墙的长度 [题解] 画图易得答案为凸包的 ...
- POJ 1113 Wall【凸包周长】
题目: http://poj.org/problem?id=1113 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=22013#probl ...
随机推荐
- 根据不同访问设备跳转到PC页面或手机页面
目前很多网站都是采用了响应式自适应页面的设计了,根据访问设备的不同,显示不同的内容.但是还是会有一些节奏比较慢的网站,还是PC页面和手机PAD页面不同的访问域名.正好我这里有个需要,同一个域名要根据不 ...
- 使用java命令出现Error: A JNI error has occurred, please check your installation and try again的错误
运行Java程序,javac运行.java文件没有报错,但java运行的时候报错 仔细看一下报错 Exception in thread "main" java.lang. ...
- 解决eclipse的自动换行问题。
安装方法:使用Eclipse 的自动升级功能,菜单栏选Help → install new Software 点解Add按钮,在“ Name ”中填入“ wordwrap ”,“ URL ”中填入“ ...
- 模块化 Sea.js(CMD)规范 RequireJS(AMD)规范 的用法
插入第三方库AMD CMD都 一样 如:JQ(再JQ源码里修改) 使用seajs的步骤 1.HTML里引入seajs <script src="./lib/sea.js"& ...
- Unity资源内存管理--webstream控制
一 使用前提 1,需要使用资源热更新 2,使用Assetbundle资源热更(AssetBundle是产生webstream的元凶) 二 为什么要用AssetBundle AssetBundle本质上 ...
- jsonp实现ajax跨域
前端 dataType为jsonp,若不指定回调函数名则默认为callback $.ajax({ url:headUrl+'/img/getImgList', type:'GET', dataType ...
- linux实时时钟相关函数
time 功能:获取1970年1月1日00:00:00到现在的秒数 原型:time_t time(time_t *t); 参数: t:获取到的秒数 返回:获取到的秒数 说明:在time.h中定义了ti ...
- Windows MySQL测试数据库employees的导入
一: 首先下载employees测试数据库 https://launchpad.net/test-db/ 二:用文本编辑器打开其中的employees.sql文件,将第38行的set storage_ ...
- JS快排
- Python matplotlib.pyplot
Customize the label, title, and ticks. Add Color to bubbles Add Text & Grid