此坑待填 离散化思想和凸包 UVA - 10173 Smallest Bounding Rectangle
Smallest Bounding Rectangle
Given the Cartesian coordinates of n(>0)2-dimensional points, write a program that computes the area of their smallest bounding rectangle (smallest rectangle containing all the given points).
Input
The input le may contain multiple test cases. Each test case begins with a line containing a positive
integer n(<1001) indicating the number of points in this test case. Then follows n lines each containing
two real numbers giving respectively the x - and y
-coordinates of a point. The input terminates with a
test case containing a value 0 for n which must not be processed.
Output
For each test case in the input print a line containing the area of the smallest bounding rectangle
rounded to the 4th digit after the decimal point.
Sample Input
3
-3.000 5.000
7.000 9.000
17.000 5.000
4
10.000 10.000
10.000 20.000
20.000 20.000
20.000 10.000
0
Sample Output
80.0000
100.0000
给定平面上n个点的坐标,求能够覆盖所有这些点的最小矩形面积。这个问题难就难在,这个矩形可以倾斜放置(边不必平行于坐标轴)。
此坑待填 离散化思想和凸包 UVA - 10173 Smallest Bounding Rectangle的更多相关文章
- UVA 12307 Smallest Enclosing Rectangle(旋转卡壳)
题意:给你一些点,找出两个可以包含所有点的矩形,一个保证矩形面积最小,一个保证矩形周长最小,输出两个最小值 题解:首先根据所有点求一个凸包,再在这个凸包上枚举每条边,作为矩形的一条边(这样可以保证最小 ...
- UVA 12307 Smallest Enclosing Rectangle
https://vjudge.net/problem/UVA-12307 求覆盖所有点的最小矩形面积.周长 相当于求凸包的最小面积外接矩形.最小周长外接矩形 结论: 这个矩形一定有一条边和凸包上一条边 ...
- UVA 221 城市化地图(离散化思想)
题意: 给出若干个栋楼俯视图的坐标和面积,求从俯视图的南面(可以视为正视图)看过去到底能看到多少栋楼. 输入第一个n说明有n栋楼,然后输入5个实数(注意是实数),分别是楼的左下角坐标(x,y), 然后 ...
- HDU5124:lines(线段树+离散化)或(离散化思想)
http://acm.hdu.edu.cn/showproblem.php?pid=5124 Problem Description John has several lines. The lines ...
- UVA 10173 (几何凸包)
判断矩形能包围点集的最小面积:凸包 #include <iostream> #include <cmath> #include <cstdio> #include ...
- 简单几何(数学公式+凸包) UVA 11168 Airport
题目传送门 题意:找一条直线,使得其余的点都在直线的同一侧,而且使得到直线的平均距离最短. 分析:训练指南P274,先求凸包,如果每条边都算一边的话,是O (n ^ 2),然而根据公式知直线一般式为A ...
- 2008 APAC local onsites C Millionaire (动态规划,离散化思想)
Problem You have been invited to the popular TV show "Would you like to be a millionaire?" ...
- UVA 10173
bitch bitch bitch... TLE,WA一大坨,我是在拿生命来JUDGE啊.. 不得不说,UVA上的数据根本不是随机的,而是有预谋的. for(int i=2;i<n;i++){ ...
- UVA 12300 Smallest Regular Polygon(正多边形)
题意:给出两点,求经过这两点的正n边形的最小面积 题解:这两点一定是最长的弦,我们设正多边形中点c,找到c到每个点的距离(都相同) 我们知道那个等腰三角形的底与每个角度就使用余弦定理 #include ...
随机推荐
- AJPFX分享java排序之希尔排序
(1)基本思想:算法先将要排序的一组数按某个增量d(n/2,n为要排序数的个数)分成若干组,每组中记录的下标相差d.对每组中全部元素进行直接插入排序,然后再用一个较小的增量(d/2)对它进行分组,在每 ...
- Java开发中存在这样的代码,反而影响整体整洁和可读性
不完美的库类 不完美的库类(Incomplete Library Class) 当一个类库已经不能满足实际需要时,你就不得不改变这个库(如果这个库是只读的,那就没辙了). 问题原因 许多编程技术都建立 ...
- drupal中文安装指导
(注:drupal6中文包放在profiles/default/translations下,drupal7放在profiles/standard/translations下) Drupal 6 中文安 ...
- webpack(2)
在普通页面中使用render函数渲染组件 render:function(createElements){//createElements是一个方法,调用它,能够把指定的组件模板,渲染成为HTML结构 ...
- Objective-C Protocols
Objective-C allows you to define protocols, which declare the methods expected to be used for a part ...
- 限制UITextField输入长度
如果要限制UITextField输入长度最长不超过kMaxLength,那么需要实现做以下操作: 1.实现UITextFieldDelegate协议: 2.实现textField:shouldChan ...
- ActiveAndroid问题no such table解决总结
android.database.sqlite.SQLiteException: no such table at android.database.sqlite.SQLiteConnection ...
- 几个不错的APP网站。
http://www.yunshipei.com/yunshipei.html http://www.appcan.cn/
- Open Cascade:AIS_InteractiveContext如何调用函数选择AIS对象
AIS_InteractiveContext如何调用函数选择AIS对象 myAISContext->MoveTo(point.x, point.y, myView); myAISContext- ...
- Linux命令基础操作--vim 归档 压缩 分区 格式化 挂载 Innode
1 将用户信息数据库文件和组信息数据库文件纵向合并为一个文件/1.txt(覆盖) 使用 cat命令将查看的文件合并输出到/1.txt 这里的关键:定位到文件,如果后面加上/后被认为是目录 分为两步,先 ...