此坑待填 离散化思想和凸包 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 ...
随机推荐
- 随机不重复的取数组元素,并赋值给div使用
function pos(){ var items = $('.starone'); items.each(function () { var rand = getRandom(); $(this). ...
- MFC命令行及CCommandLineInfo类
获取命令行的方法: 1.GetCommandLine() 获取输入的所有信息,包括程序所在路径及参数 2.AfxGetApp()->m_lpCmdLine 只包含参数 一般情况下,获取到命令行后 ...
- iOS 自定义读写文件
LSCacheFile.h // // LSCacheFile.h // iPhone // // Created by xujinzhong on 14-6-5. // Copyright (c) ...
- springmvc+maven搭建web项目
1.创建一个maven project 为spring1 2.进行项目的配置:默认的java 1.5 在properties中选择project facts项目进行配置,反选web之后修改java环境 ...
- jni 修bug
1. ReferenceTable overflow (max=512) 内存泄露,程序运行一段时间就挂掉了. 在利用反射调用java中的函数需要释放掉查找到的类 void publishJava ...
- 简单的 创建AJax的方法
// 简单的ajax对象 var myAjax = { // XMLHttpRequest IE7+, Firefox, Chrome, Opera, Safari : ActiveXObject I ...
- linux下怎么修改mysql的字符集编码
安装完的MySQL的默认字符集为 latin1 ,为了要将其字符集改为用户所需要的(比如utf8),就必须改其相关的配置文件:由于linux下MySQL的默认安装目录分布在不同的文件下:不像windo ...
- vue-cli3.0 生产包去除console.log
目前负责的公众号又迭代了一个版本,之前打生产包,配置总是和测试包搞混,所以使用了vue-cli3.0的环境变量来控制配置. 但是又发现了一个新问题,写代码的过程中写了很多console.log 来调试 ...
- abaqus二次开发概述
说明 abaqus二次开发概述 导语 用户子程序特点 abaqus用户程序接口与调用方式 abaqus用户子程序分类 常用用户子程序介绍 Refence 说明 本系列文章本人基本没有原创贡献,都是在学 ...
- Dajngo admin
Dajngo admin admin app Django 提供了基于 web 的管理工具. Django 自动管理工具是 django.contrib 的一部分.你可以在项目的 settings.p ...