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 ...
随机推荐
- 大数据面试题——如何找出访问最多的IP
问题描述: 现有海量日志数据保存在一个超大的文件中,该文件无法直接存入内存,要求从 中提取某天访问BD次数最多的IP 分析解读: 由于这个题目只关心某一天访问次数最多的IP,因此可以首先对文件进行一次 ...
- 关于WCF服务 http://XXXXXX/XXX/xxx.svc不支持内容类型 application/sop+xml;charset=utf-8 错误解决方法
有时候用IIS部署一个WCF服务时,无论是在客户端还是在服务端通过地址都能正常访问. 但是当你在客户端添加服务引用时, 怎么也添加不上, 会碰到了如下错误: 好啦. 现在说说怎么解决吧. 其实很简单. ...
- 20190219备份 java spring boot 学习链接(日/英)
Building web applications with Spring Boot and Kotlin https://www.slideshare.net/masuda220/spring-82 ...
- yuv2mp4
>您使用什么类型的YUV像素格式?最常见的格式是YUV4:2:0平面8位(YUV420p).您可以键入ffmpeg -pix_fmts以获取所有可用格式的列表.>什么是帧率?在我的例子中, ...
- 安装selenium,驱动geckodriver,及出现的问题
cmd输入安装selenium指令: pip install selenium 1.报错 Could not find a version that satisfies the requirement ...
- ansible-play中for,if的使用
#迭代循环的使用 #实现同时新建三个文件,同时部署三个服务 --- - host: websrvs remote_user: root task: - name: create some files ...
- 图像转化成TFrecords格式并回转
import os import tensorflow as tf from PIL import Image import numpy as np cat_image_path='D:/软件/pyc ...
- 编译libcurl支持https协议
编译与安装参考:http://www.cnblogs.com/openiris/p/3812443.html 注意事项:先下载安装完nasm和perl再打开控制台(需要将nasm安装路径添加到Path ...
- 策略模式在ThreadpoolExecutor中的应用
偶然读到ThreadpoolExecutor的源码,发现里面使用到了策略模式,抓出来和大家分享下: 感兴趣的朋友们可以读读 ThreadPoolExecutor的源码: public void set ...
- 循环输出ViewBag集合
<tr> <td> 权限分配: </td> <td> ...