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 ...
随机推荐
- oracle数据库 查看被锁定表及解锁方法
最近做项目,遇到了更新超时的问题,反复检查数据都正常,纳闷完了忽然想到是不是表被锁定了,一看果然,解决办法如下: --锁表查询语句 SELECT object_name, machine, s.sid ...
- [Leetcode 452] 最少需要射出多少支箭Minimum Number of Arrows to Burst Balloons 贪心 重载
[题目] There are a number of spherical balloons spread in two-dimensional space. For each balloon, pro ...
- 幽灵自建的html5 的模板文件!
<!-- ,s555SB@@& :9H####@@@@@Xi 1@@@@@@@@@@@@@@8 ,8@@@@@@@@@B@@@@@@8 :B@@@@X3hi8Bs;B@@@@@Ah, , ...
- Python的基础语法
一,编码 默认情况下,Python 3 源码文件以 UTF-8 编码,所有字符串都是 unicode 字符串. 当然你也可以为源码文件指定不同的编码: 1 # -*- coding: cp-1252 ...
- 【转】Linux的nm查看动态库和静态库的符号
转自https://blog.csdn.net/qq_16683355/article/details/52297884 功能 列出.o..a..so中的符号信息,包括符号的值,符号类型及符号名称等. ...
- Problem 4: Largest palindrome product
A palindromic number reads the same both ways. The largest palindrome made from the product of two 2 ...
- TCP学习总结(二)
前面一节咱们介绍完了TCP协议,这部分,将要介绍,TCP是如何实现可靠传输的. TCP的可靠传输 1.滑动窗口 上一节我们介绍TCP报文段头部的时候说得到,"窗口"这个部分,&qu ...
- 服务器搭建lamp环境
使用的例子:服务器版本内核centos 7.04 Xshell连接到您的服务器上,使系统处于最新状态执行以下命令, yum update -y 利用yum命令安装Apache执行命令, ...
- JavaScript Node节点笔记
1. 节点及其类型: 1). 元素节点 2). 属性节点: 元素的属性, 可以直接通过属性的方式来操作. 3). 文本节点: 是元素节点的子节点, 其内容为文本. 2. 在 html 文档的什么位置编 ...
- 【解决】Server Tomcat v7.0 Server at localhost failed to start.
Server Tomcat v7.0 Server at localhost failed to start. 出现此原因是因为servlet-name不匹配 修改一致即可