problem

812. Largest Triangle Area

solution:

class Solution {
public:
double largestTriangleArea(vector<vector<int>>& points) {
double res = 0.0;
int x1=, y1=, x2=, y2=, x3=, y3=;
for(int i=; i<points.size(); ++i)
{
for(int j=i+; j<points.size(); ++j)
{
for(int k=j+; k<points.size(); ++k)
{
x1 = points[i][]; y1 = points[i][];
x2 = points[j][]; y2 = points[j][];
x3 = points[k][]; y3 = points[k][];
double area = 0.5*abs(x1*y2+x2*y3+x3*y1-
y1*x2-y2*x3-y3*x1);
res = max(res, area);
}
}
}
return res;
}
};

参考

1. Leetcode_easy_812. Largest Triangle Area;

2. Grandyang;

【Leetcode_easy】812. Largest Triangle Area的更多相关文章

  1. 【LeetCode】812. Largest Triangle Area 解题报告(Python)

    作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 三重循环 组合函数 日期 题目地址:https:// ...

  2. LeetCode 812 Largest Triangle Area 解题报告

    题目要求 You have a list of points in the plane. Return the area of the largest triangle that can be for ...

  3. 【Leetcode_easy】976. Largest Perimeter Triangle

    problem 976. Largest Perimeter Triangle solution: class Solution { public: int largestPerimeter(vect ...

  4. 【Leetcode_easy】949. Largest Time for Given Digits

    problem 949. Largest Time for Given Digits solution: class Solution { public: string largestTimeFrom ...

  5. 【Leetcode_easy】747. Largest Number At Least Twice of Others

    problem 747. Largest Number At Least Twice of Others 题意: solution1: class Solution { public: int dom ...

  6. 812. Largest Triangle Area

    static int wing=[]() { std::ios::sync_with_stdio(false); cin.tie(NULL); ; }(); class Solution { publ ...

  7. 【LeetCode】764. Largest Plus Sign 解题报告(Python)

    [LeetCode]764. Largest Plus Sign 解题报告(Python) 作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn ...

  8. 【LeetCode】Pascal's Triangle II 解题报告

    [LeetCode]Pascal's Triangle II 解题报告 标签(空格分隔): LeetCode 题目地址:https://leetcode.com/problems/pascals-tr ...

  9. 【LeetCode】813. Largest Sum of Averages 解题报告(Python)

    [LeetCode]813. Largest Sum of Averages 解题报告(Python) 标签(空格分隔): LeetCode 作者: 负雪明烛 id: fuxuemingzhu 个人博 ...

随机推荐

  1. java中的switch

    switch 语句由一个控制表达式和多个case标签组成. switch 控制表达式支持的类型有byte.short.char.int.enum(Java 5).String(Java 7). swi ...

  2. Linux下安装nginx实现伪分布

    1.安装 Nginx 的编译环境 gcc yum install gcc-c++ 2.nginx 的 http 模块使用 pcre 解析正则表达式,所以安装 perl 兼容的正则表达式库 yum in ...

  3. Miniprofiler 监控ef执行详解

    首先NuGet添加 相对应ef版本的Miniprofiler.ef引用 web.config文件中添加 <system.webServer> <handlers>  <a ...

  4. /etc/sysconfig/network-scripts/ifcfg-ensxx

    TYPE=Ethernet PROXY_METHOD=none BROWSER_ONLY=no BOOTPROTO=static # 获取ip的方式,static表示静态设置的ip,还有dhcp,系统 ...

  5. 【概率论】5-1:分布介绍(Special Distribution Introduction)

    title: [概率论]5-1:分布介绍(Special Distribution Introduction) categories: - Mathematic - Probability keywo ...

  6. linux下安装python3.6.6

    1.到python的官网去下载python3.6.3安装包,必须是Linux版本的 2.在/usr/tmp下下载python安装包 wget https://www.python.org/ftp/py ...

  7. jQuery多选和单选下拉框插件select.js

    一.插件描述 可通过参数设置多选或者单选,多选返回数组结果,单选返回字符串,如图: 下载地址:https://pan.baidu.com/s/1JjVoK89_ueVVpfSlMDJwUQ   提取码 ...

  8. Fidller抓包分析post请求

    目的:抓包是为了最近做接口测试做准备,以前没有用过这个工具,最近来学下,但是网上很多文章了,所以不一一记录,有一部分参考即可 1.如何抓取想要的web端或者手机端包,已经有很多文章谢了,推荐的参考文章 ...

  9. Selenium 八种元素定位方法

    前言: 我们在做WEB自动化时,最根本的就是操作页面上的元素,首先我们要能找到这些元素,然后才能操作这些元素.工具或代码无法像我们测试人员一样用肉眼来分辨页面上的元素.那么我们怎么来定位他们呢? 在学 ...

  10. [信息收集]Nmap命令详解

    0x00[介绍] Nmap,也就是Network Mapper,中文为"网络映射器". Nmap是一款开源的网络探测和安全审核的工具,它的设计目标是快速地扫描大型网络. 它是网络管 ...