A14482 | Framing Pictures
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
Life has been discovered on Venus! What is more, the life forms appear to be convex polygons. An international consortium is designing a probe to send to Venus to take pictures, but they need to estimate the bandwidth needed to send back pictures.
When the probe takes a picture of a life form and wishes to send it back to Earth, the bandwidth required is proportional to the area of the bounding box (in other words, the smallest axis-aligned rectangle that contains the life-form). The shape and size of the life forms are known, but the orientation relative to the camera is random. You must thus determine the expected (average) area of the bounding box across all orientations.
When the probe takes a picture of a life form and wishes to send it back to Earth, the bandwidth required is proportional to the area of the bounding box (in other words, the smallest axis-aligned rectangle that contains the life-form). The shape and size of the life forms are known, but the orientation relative to the camera is random. You must thus determine the expected (average) area of the bounding box across all orientations.
输入格式
The input describes the shape of a life form as a convex polygon in two dimensions.
The first line of input contains an integer $n$ ( $3 \le n \le 200\,000$ ) — the number of vertices. The remaining $n$ lines each contain two integers $x$ and $y$ ( $-10^9 \le x, y \le 10^9$ ) — the coordinates of a vertex. The vertices are given in counterclockwise order, and no three vertices lie on a straight line.
The first line of input contains an integer $n$ ( $3 \le n \le 200\,000$ ) — the number of vertices. The remaining $n$ lines each contain two integers $x$ and $y$ ( $-10^9 \le x, y \le 10^9$ ) — the coordinates of a vertex. The vertices are given in counterclockwise order, and no three vertices lie on a straight line.
输出格式
Output a single line containing the expected area of the bounding box of the polygon. Your answer should have an absolute or relative error of at most $10^{-6}$ .
输入输出样例
输入 #1
4 0 0 10 0 10 10 0 10
输出 #1
163.661977237
输入 #2
5 0 0 10 0 15 8 5 20 -5 7
输出 #2
365.666028588
The pictures show example life forms and various camera orientations.
 
 
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted