codeforces_614A. Peter and Snow Blower(点到线段距离)

离线路径规划服务Graphhopper 离线路径规划服务Graphhopper 本文主要探索使用Graphhopper搭建离线路径规划服务,需要掌握一定的JAVA基础环境配置的知识 文章目录离线路径规划服务Graphhopper前言一、Graphhopper是什么?二、使用步骤1.下载Graphhopper2.从OpenStreetMap下载路图数据3.安装Graphhopper所需环境4.修改配置5.启动Graphhopper总结 前言 在外网环境中可以使用百度、高德等第三方的sdk用以实现路径规划的功能,由于项目的需要,在离线环境中需要使 阅读详情
A. Peter and Snow Blower
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

Peter got a new snow blower as a New Year present. Of course, Peter decided to try it immediately. After reading the instructions he realized that it does not work like regular snow blowing machines. In order to make it work, you need to tie it to some point that it does not cover, and then switch it on. As a result it will go along a circle around this point and will remove all the snow from its path.

Formally, we assume that Peter's machine is a polygon on a plane. Then, after the machine is switched on, it will make a circle around the point to which Peter tied it (this point lies strictly outside the polygon). That is, each of the points lying within or on the border of the polygon will move along the circular trajectory, with the center of the circle at the point to which Peter tied his machine.

Peter decided to tie his car to point P and now he is wondering what is the area of ​​the region that will be cleared from snow. Help him.

Input

The first line of the input contains three integers — the number of vertices of the polygon n (), and coordinates of point P.

Each of the next n lines contains two integers — coordinates of the vertices of the polygon in the clockwise or counterclockwise order. It is guaranteed that no three consecutive vertices lie on a common straight line.

All the numbers in the input are integers that do not exceed 1 000 000 in their absolute value.

Output

Print a single real value number — the area of the region that will be cleared. Your answer will be considered correct if its absolute or relative error does not exceed 10 - 6.

Namely: let's assume that your answer is a, and the answer of the jury is b. The checker program will consider your answer correct, if .

Examples
input
3 0 0
0 1
-1 2
1 2
output
12.566370614359172464
input
4 1 -1
0 0
1 2
2 0
1 1
output
21.991148575128551812
Note

In the first sample snow will be removed from that area:

对几何一窍不通,看了题解报告后,积累一下一些几何的模板
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <stack>
#include <bitset>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#define Si(a) scanf("%d",&a)
#define Sl(a) scanf("%lld",&a)
#define Sd(a) scanf("%lf",&a)
#define Ss(a) scanf("%s",a)
#define Pi(a) printf("%d\n",(a))
#define Pl(a) printf("%lld\n",(a))
#define Pd(a) printf("%lf\n",(a))
#define Ps(a) printf("%s\n",(a))
#define W(a) while(a--)
#define mem(a,b) memset(a,(b),sizeof(a))
#define FOP freopen("data.txt","r",stdin)
#define inf 0x3f3f3f3f
#define maxn 100010
#define mod 1000000007
#define PI acos(-1.0)
#define LL long long
using namespace std;
template <class T1,class T2>inline void gmax(T1 &a,T2 b){if(b>a)a=b;}
template <class T1,class T2>inline void gmin(T1 &a,T2 b){if(b<a)a=b;}

struct Point
{
    double x,y;
    Point(){};
    Point(double a,double b){x=a,y=b;};
    Point operator - (const Point& a)const
    {
        return Point(x-a.x, y-a.y);
    }
}P,a[maxn];

//求两个向量的点积
double Dot(Point &a,Point &b)
{
    return a.x*b.x+a.y*b.y;
}

//返回一个向量的长度
double Len(Point a)
{
    return sqrt(a.x*a.x+a.y*a.y);
}

//返回两个点的距离
double Dis(Point &a,Point &b)
{
    return Len(Point(a-b));
}

//返回点a到线段bc的最短距离
double PointToSegment(Point &a,Point &b,Point &c)
{
    Point x=a-b;
    Point y=c-b;
    Point z=c-a;
    if(Dot(x,y)<0)return Len(x);
    if(Dot(y,z)<0)return Len(z);
    return fabs((x.x*y.y-x.y*y.x)/Len(y));
}
int main()
{
    int i,n;
    Si(n);
    Sd(P.x),Sd(P.y);
    for(i=1;i<=n;i++)
    {
        Sd(a[i].x),Sd(a[i].y);
    }
    a[n+1]=a[1];
    double maxdis=0,mindis=1e18;
    for(i=1;i<=n;i++)
    {
        gmax(maxdis,Dis(a[i],P));
        gmin(mindis,PointToSegment(P,a[i],a[i+1]));
    }

    double ans=PI*(maxdis*maxdis-mindis*mindis);

    printf("%.15lf\n",ans);
    return 0;
}


NHANES更新数据后,权重计算方式也更新了 官网说明在此:如果你比我还懒,我下载了几个说明文件。2021年8月至2023年8月的总样本量与之前的2年周期相似。然而,。特别是,与之前包括过度抽样的周期相比,非西班牙裔白人的样本量较高,而非西班牙裔黑人的样本量较低。此外,60岁及以上人群的样本量较高,而年轻群体的样本量较低。子组的估计值可能具有较低的精确度,因此,检测组间差异的统计能力可能较低。此外,年龄和种族/西班牙裔亚组(尤其是儿童和青少年年龄组)的估计值可能会显示意想不到的模式。 阅读详情

相关推荐

【阿里云大模型高级工程师ACP习题集】2.3 优化提示词改善答疑机器人回答质量

【摘要】这是我精心整理出对应的习题集,里面足足有 30 道题目,从基础概念到深度拓展,全方位覆盖章节重点、难点。不管你是想检验自己的学习成果,还是想针对薄弱环节进行强化训练,它都能完美适配!

davidkorhenn的博客 1627

CodeForces 614C Peter and Snow Blower【计算几何】

C. Peter and Snow Blower time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Peter got a new snow blower as a N

希望的专栏 1007

一步一步教你写股票走势图——K线图一(概述)

股票分时图部分已经开发完毕,受到了广大开发者的好评!界面、功能都挺完美,解决了好一些MP开发者的问题,博主甚是欣悦,更有动力去开源K线图。这里说一下,如果有问题直接留言或者发邮件,github上个人信息有邮件,我看到基本都会回复,博主不加qq的,体谅O(∩_∩)O。分析好了,废话不多说,我们分析下K线图吧,首先我们看下自选股K线图的效果吧效果还是很赞的,经过分时图的研究后,博主越来越确信自选股用的应

体验Android编程之美 3万+

Codeforces Round #339 (Div. 2)-C. Peter and Snow Blower

Peter got a new snow blower as a New Year present. Of course, Peter decided to try it immediately. After reading the instructions he realized that it does not work like regular snow blowing machines. I

long-long-ago 1074

FFmpeg视频编码的流程详解及参考demo

本文主要讲解FFmpeg的视频编码的具体流程,API使用。最后再以一个非常简单的demo演示将一个yuv数据文件编码为H264的视频文件,也就是YUV编码为H264。

分享音视频技术 4498

UG NX 12.0零基础实战:从草图绘制到三维建模全流程解析

本文详细解析UG NX 12.0从草图绘制到三维建模的全流程,适合零基础用户快速掌握这款工业设计软件。内容涵盖界面设置、基础操作、草图技巧、拉伸旋转建模、布尔运算等核心功能,并通过机械零件实战案例演示完整设计流程,帮助读者系统学习UG NX 12.0的工业设计应用。

weixin_29261711的博客 1165

【Codeforces Round 339 (Div 2)C】【计算几何 点到直线的距离模板】Peter and Snow Blower 多边形整体绕一圆心旋转的运行面积

C. Peter and Snow Blower time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Peter got a new snow blower as a N

snowy_smile的博客 1340

【Tessent Shell Users Manual】【Ch3】Design Introspection and Editing(未完待续)

Tessent Shell 提供了一系列用于检查(examining/introspecting)和编辑design的命令。

Tranquil_ovo的博客 1730

CF 614C. Peter And Snow Blower 点到多边形的最短距离

题意:给出一个定点和一个n个点的多边形. 现在将这个多边形绕着定点旋转一圈.问这一圈的面积为多少? 多边形绕定点旋转 相等于多变形内所有的点绕定点旋转一圈. 设多边形上离顶点最远和最短的距离为mx,mn 那么答案显然为pi*(mx^2-mn^2) mx为定点到多边形顶点的最远距离,mn为定点到多边形的边的最短距离 mn利用向量积来求,注意定点到边的垂足是否在边的延长线上.

noone0的博客 1870

Vue3 - 详细实现微信公众号H5网页内置浏览器中预览下载word文档(doc)、excel表格(xls)、ppt文稿、pdf文档等文件,微信内部直接打开预览和下载到本地教程,安卓苹果手机无差异兼容

vue3,nuxt3,微信公众号,h5,移动端,网页,网站,vue微信内置浏览器下载文件,下载文件,在微信浏览器里面实现下载任意文件,H5需要在微信浏览器中下载excel文件,实现网页在微信内置浏览器中下载文件详细教程,安卓点击下载会提示打开浏览器,后端返回流文件,如何解决无法下载文件,跳转至浏览器下载文件,发送到电脑微信,安卓,苹果,手机系统,微信H5页面,vue3微信公众号H5网站,内置浏览器下载文档,如何在微信浏览器中预览office文件,word文档,excel文档,pdf文档,ppt文档,offi

🏆 前端领域优质创作者 1万+

BMP280气压传感器原理图设计,已量产(压力传感器)

做嵌入式项目时,“小而精” 的传感器模块永远是刚需 —— 尤其是需要同时测气压和温度的场景,比如无人机定高、环境监测节点、穿戴设备等。最近捣鼓了一款 BMP280 的 Breakout 板,封装做得很紧凑,同时兼顾了稳定性和兼容性,这里单聊硬件设计细节。

不脱发的程序猿 298

Codeforces Peter 614 C and Snow Blower

传送门:http://codeforces.com/contest/613/problem/A 计算几何: 计算一个多边形绕着圆心旋转一周所得区域的面积,通过样例就可以看出应该是是一个圆环,所以只需要找到图形上到圆心的最远点和最近点即可,最远点一定在点上,最近点可能在点上可能在边上,具体判断方法是:由于点的给出方法为顺时针或逆时针,所以只需要O(1)扫一遍环即可,利用余弦定理去判断形成的角是否为

yp_2013的博客 939

OV9734 DATASHEET,完整规格书

OV9734完整规格书,包括电气参数,尺寸规格,寄存器配置表等

CodeForces 614C. Peter and Snow Blower

C. Peter and Snow Blower time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Peter got a new snow blower as a N

KeyboardPianist的博客 923

霍尼韦尔SoftMaster使用说明

霍尼韦尔SoftMaster使用说明

数学建模模型总结

这是本人在两年内准备参加数学建模竞赛搜集到的模型资料,已经经过了本人的筛选和整理,希望能够对准备参加数学建模竞赛的学弟学妹们提供一些帮助!

Peter and Snow Blower Codeforces 614C (计算几何,点距离多边形最近距离)

题目链接:http://codeforces.com/problemset/problem/614/C 题目大意:       下雪了,于是小明买了个多边形的扫雪器,多边形只能围绕一个点做圆周运动,那么给出这个点,以及顺时针给出多边形的各个点求这个多变形做圆周运动扫过的面积。 思路:        样例已经给了很清楚的解释。所能扫到最远的距离的一定是多边形的某个顶点,所以最远的确定下来了。...

qq_41645482的博客 761

VC中sqlite的使用

在VC中对sqlite的使用,实现数据库大批数据的快速插入,读取数据库中的数据在ListCtrl中显示

codeforces 614 C Peter and Snow Blower

C. Peter and Snow Blower time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Peter got a new snow blower as a N

阑珊记忆 512

Codeforces 614C Peter and Snow Blower (计算几何点到线段距离)

Codeforces 614C Peter and Snow Blower (计算几何点到线段距离) 题意 给一个多边形扫雪机,绕定点转圈,求扫过的面积。 思路 求离圆心最远的点和离圆心最近的点,分别画圆减一减就可以了。但需要注意的是离圆心最近的点不一定是多边形的端点,也可能是圆心到线段的垂线(如果垂足在线段内)。 教训:积累一下计算几何的板子。 代码 #include &lt;iostream&...

口丁乙orz各位菊苣口下留情orz口丁乙 346

Codeforces 614C Peter and Snow Blower

C. Peter and Snow Blower time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Peter got a new snow blower as a New Year pr

fanesemyk的博客 692

训练赛一:几何题目 (CodeForce 614C Peter and Snow Blower)

Peter and Snow Blower(CodeForce 614C\CodeForce613A) 洛谷上的链接:https://www.luogu.org/problemnew/show/CF613A 题目大意 给你好多个点,这些点依次连起来形成一个多边形,这个多边形绕着多边形外面的一个定点旋转一周,问这个多边形扫过的面积为多少。 也就是求大圆减去小圆的面积。 思路 这里只要求出大圆的半径和...

Authur_gyc 291

Peter and Snow Blower CodeForces - 614C 几何

题目链接: Peter and Snow Blower CodeForces - 614C 题目大意一个n边形, 顺时针方向给出所有顶点, 给你一个p点, 让n边形绕p点旋转, 求n边形扫过的面积(p点严格在n边形外, 我想这里的严格指的是如果多边形是凹的, 也不会在凹槽里面, 开始的时候我还判断了是否会在多边形里面…) 3≤n≤105,点坐标绝对值不超过1063 \leq n \leq 10^5

litmxs的博客 586

CodeForces 614C Peter and Snow Blower

CodeForces 614C  Peter and Snow Blower time limit per test:2 seconds memory limit per test:256 megabytes input:standard input output:standard output Peter got a new snow blower

这儿有个bug 697

[CodeForces - 614C] C - Peter and Snow Blower

C - Peter and Snow Blower Peter got a new snow blower as a New Year present. Of course, Peter decided to try it immediately. After reading the instructions he realized that it does not work like...

a8233821的博客 200

第一次训练赛D - Peter and Snow Blower-简单几何

题目传送门:https://codeforces.com/problemset/problem/614/C 题目大意:求一个多边形绕他外面一个点转扫过的面积。 mmp比赛时看错题了,以为那个点可以在图形内,浪费了半个钟。 思路:S=PI*(点到图形最远距离^2 - 点到图形最近距离^2),点到图形最远距离即点到图中的最远的点的距离,最近距离可能是点到点,也可能是点到边,比赛时忘了点到边的情况。算点...

weixin_30149299的博客 251

【14.36%】【codeforces 614C】Peter and Snow Blower

time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Peter got a new snow blower as a New Year present. Of course, Peter decided ...

AWCXV 141

CodeForces 614C Peter and Snow Blower

简单计算几何,只要算出圆心到多边形上的最短距离和最长距离即可 #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> using namespace std; const int maxn=100000+10; struct Point { ...

weixin_34362991的博客 89

Codeforces614C Peter and Snow Blower

题意:各一个点,一个多边形,多边形绕着这个点转,问转过的面积是多少 题解:可以发现转过的面积就是一个圆环,这里的多边形可能是凹多边形,环外的半径就是到点的最远距离,环内的半径就是多边形的边的线段到点的最小距离 #include <bits/stdc++.h> #define maxn 100010 #define INF 0x3f3f3f3f typedef long l...

weixin_30306905的博客 87
上一篇: codeforces_652C. Watchmen(map)
下一篇: codeforces_607A. Chain Reaction(二分+简单dp)
christry_stool
博客等级 码龄11年 9粉丝 109原创
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值