1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-10 18:48:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/最大三角形面积 [largest-triangle-area].html

29 lines
1.2 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<p>给你一个由 <strong>X-Y</strong> 平面上的点组成的数组 <code>points</code> ,其中 <code>points[i] = [x<sub>i</sub>, y<sub>i</sub>]</code> 。从其中取任意三个不同的点组成三角形,返回能组成的最大三角形的面积。与真实值误差在 <code>10<sup>-5</sup></code> 内的答案将会视为正确答案<strong></strong></p>
<p>&nbsp;</p>
<p><strong class="example">示例 1</strong></p>
<img alt="" src="https://s3-lc-upload.s3.amazonaws.com/uploads/2018/04/04/1027.png" style="height: 369px; width: 450px;" />
<pre>
<strong>输入:</strong>points = [[0,0],[0,1],[1,0],[0,2],[2,0]]
<strong>输出:</strong>2.00000
<strong>解释:</strong>输入中的 5 个点如上图所示,红色的三角形面积最大。
</pre>
<p><strong class="example">示例 2</strong></p>
<pre>
<strong>输入:</strong>points = [[1,0],[0,0],[0,1]]
<strong>输出:</strong>0.50000
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>3 &lt;= points.length &lt;= 50</code></li>
<li><code>-50 &lt;= x<sub>i</sub>, y<sub>i</sub> &lt;= 50</code></li>
<li>给出的所有点 <strong>互不相同</strong></li>
</ul>