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 ...
随机推荐
- C# [Win32] [GDI+] [API] Load HFONT from Memory
// gdiplusenums.h //-------------------------------------------------------------------------- // Fo ...
- saltstack高效运维
saltstack高效运维 salt介绍 saltstack是由thomas Hatch于2011年创建的一个开源项目,设计初衷是为了实现一个快速的远程执行系统. salt强大吗 系统管理员日常会 ...
- storcli 简易使用介绍
MegaCli 是LSI公司官方提供的SCSI卡管理工具,由于LSI被收购变成了现在的Broadcom,所以现在想下载MegaCli,需要去Broadcom官网查找Legacy产品支持,搜索MegaR ...
- 下载、安装 SQL server 2012,一步一步教你安装、激活sql server2012数据库 ,附有数据库安装包
一. 准备阶段:下载2012 SQl server数据库安装包. 链接如下: 文件名:sql2012.zip 百度云链接:https://pan.baidu.com/s/1-fw1dCVbfU1bKM ...
- datatable处理gridview筛选后的值
DataTable dt = (DataTable)gridView1.GridControl.DataSource; DataRow[] drr = dt.Select(gridView1.RowF ...
- Python面向对象基础知识
面向对象是一种编程方式,此编程方式的实现是基于对类和对象的使用 类是一个模板,模板中包装了多个“函数”供使用(可以讲多函数中公用的变量封装到对象中) 对象,根据模板创建的实例(即:对象),实例用于调用 ...
- Windows下使用service.bat安装tomcat服务, 启动停止tomcat服务
在项目开发过程中,以前只是在Eclipse中配置.启动.停止tomcat服务器 如果只想在机器中使用tomcat服务器,而不想安装MyEclipse,可以使用service.bat 将tomcat安装 ...
- CentOS6.5 - yum对Mysql的安装与配置
一.mysql的安装 1.查看是否安装mysql [root@localhost ~]# rpm -qa | grep mysql 如果有进行卸载(以下三种方式选一种即可): -.el6.x86_64 ...
- Docker Toolbox
Toolbox包含以下Docker工具: 用于运行docker-machine命令的Docker Machine 用于运行docker命令的Docker Engine Docker Compose用于 ...
- Linux基础命令--date
date命令格式用法 yao@yao:~/shells/tmp$ date +%Y%m%d20190405 yao@yao:~/shells/tmp$ date +%Y%m%d%H%M%S201904 ...