leetcode812】的更多相关文章

You have a list of points in the plane. Return the area of the largest triangle that can be formed by any 3 of the points. Example: Input: points = [[0,0],[0,1],[1,0],[0,2],[2,0]] Output: 2 Explanation: The five points are show in the figure below. T…
class Solution { public: double largestTriangleArea(vector<vector<int>>& points) { double max_area = 0.0, area = 0.0; for (auto &p1 : points) { for (auto &p2 : points) { for (auto &p3 : points) { area = abs(p1[] * p2[] + p2[] *…
给定包含多个点的集合,从其中取三个点组成三角形,返回能组成的最大三角形的面积. 示例: 输入: points = [[0,0],[0,1],[1,0],[0,2],[2,0]] 输出: 2 解释: 这五个点如下图所示.组成的橙色三角形是最大的,面积为2. 注意: 3 <= points.length <= 50. 不存在重复的点. -50 <= points[i][j] <= 50. 结果误差值在 10^-6 以内都认为是正确答案. class Solution { public:…