/*
translation:
给出一组点,从这些点里面选择三个点构成三角形。求这个三角形面积最大是多少?
solution:
凸包
很容易想到三角形的三个点肯定在凸包上面,但是关键怎么找出来三个点。一一枚举肯定超时。
note:
* 如果固定一条边的话,那么枚举剩下的一个点,在枚举过程中面积肯定有达到极大值后又减小。根据这一特性,可以先固定
一点i,然后让另外两点a,b不断旋转来找三角形面积最大值(a,b事先设定成是点1和点2)。具体步骤如下:
1.枚举i后就将i固定,旋转a,直到找到三角形的最大值。同时更新答案。
2.旋转b,直到找到此时三角形的最大值。同时更新答案。此时即找到三角形一点为i时的最大面积。
3.枚举下一个i,重复1,2步骤。
*/
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
const int maxn = 50000 + 5;
struct Point
{
double x, y;
Point(){}
Point(double x_, double y_):x(x_),y(y_){}
} p[maxn], ch[maxn];
typedef Point Vector;
int n;
Vector operator + (Vector a, Vector b) { return Vector(a.x + b.x, a.y + b.y); }
Vector operator - (Point a, Point b) { return Point(a.x - b.x, a.y - b.y); }
Vector operator * (Vector a, double p) { return Vector(a.x * p, a.y * p); }
Vector operator / (Vector a, double p) { return Vector(a.x / p, a
poj2079(*凸包内最大三角形面积)
最新推荐文章于 2019-08-10 17:18:55 发布