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. vue 2.0 watch 监听对象的变化

  2. POJ-2689-Prime Distance(素数区间筛法)

    链接: https://vjudge.net/problem/POJ-2689 题意: The branch of mathematics called number theory is about ...

  3. TDOA 基础之 双曲线

    TDOA 的算法基础就是时间差,根据时间差换算出距离差,后面的数学理论知识就是双曲线交点问题. 双曲线方程是2次方程,解算曲线交点也就是两个2次方程求解. 首先看双曲线定义(百度百科): 双曲线(Hy ...

  4. java后台防止XSS的脚本攻击

    import java.util.regex.Pattern; //具体过滤关键字符public class XSSUtil { private static Pattern[] patterns = ...

  5. MVC4 Application Install

    For VS2010 http://www.asp.net/mvc/mvc4 For VS2012 http://www.asp.net/downloads

  6. Python Tinker学习笔记

    一直在简单看看python,这次项目需要做个界面,最好是要跨平台的,之前考虑QT,但是树莓派上QT跨平台编译一直装这有问题,后来发现Python不就可以么? 于是决定用python做个界面,但是做界面 ...

  7. c++ 将字符串转换为数字

    int string2int(string x); int string2int(string x){ int a; string res=x; stringstream ss; ss << ...

  8. Tkinter 之MessageBox弹出框

    一.参数说明 语法 作用 截图 tk.messagebox.showwarning(title='提示', message='你确定要删除吗?') 警告信息弹窗   tk.messagebox.sho ...

  9. linux 的real time 、user time、 sys time

    <APUE>上提到了三个时间Real time, User time和Sys time.这三者是什么关系呢?在使用time(1)命令的时候,为什么real time < user t ...

  10. linux下如何让控制台程序后台运行

    方法1:./test & 方法2:(./test &) 方法3:nohup 和bg 方法4:screen -mS test /root/test   退出程序需要手动进入screen创 ...