mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-11 02:58:13 +08:00
58 lines
1.7 KiB
HTML
58 lines
1.7 KiB
HTML
|
<p>在<meta charset="UTF-8" /> <code>n x n</code> 的网格<meta charset="UTF-8" /> <code>grid</code> 中,我们放置了一些与 x,y,z 三轴对齐的<meta charset="UTF-8" /> <code>1 x 1 x 1</code> 立方体。</p>
|
|||
|
|
|||
|
<p>每个值 <code>v = grid[i][j]</code> 表示 <code>v</code> 个正方体叠放在单元格 <code>(i, j)</code> 上。</p>
|
|||
|
|
|||
|
<p>现在,我们查看这些立方体在 <code>xy</code> 、<code>yz</code> 和 <code>zx</code> 平面上的<em>投影</em>。</p>
|
|||
|
|
|||
|
<p><strong>投影</strong> 就像影子,将 <strong>三维</strong> 形体映射到一个 <strong>二维</strong> 平面上。从顶部、前面和侧面看立方体时,我们会看到“影子”。</p>
|
|||
|
|
|||
|
<p>返回 <em>所有三个投影的总面积</em> 。</p>
|
|||
|
|
|||
|
<p> </p>
|
|||
|
|
|||
|
<ul>
|
|||
|
</ul>
|
|||
|
|
|||
|
<ul>
|
|||
|
</ul>
|
|||
|
|
|||
|
<ul>
|
|||
|
</ul>
|
|||
|
|
|||
|
<ul>
|
|||
|
</ul>
|
|||
|
|
|||
|
<p><strong>示例 1:</strong></p>
|
|||
|
|
|||
|
<p><img alt="" src="https://s3-lc-upload.s3.amazonaws.com/uploads/2018/08/02/shadow.png" style="height: 214px; width: 800px;" /></p>
|
|||
|
|
|||
|
<pre>
|
|||
|
<strong>输入:</strong>[[1,2],[3,4]]
|
|||
|
<strong>输出:</strong>17
|
|||
|
<strong>解释:</strong>这里有该形体在三个轴对齐平面上的三个投影(“阴影部分”)。
|
|||
|
</pre>
|
|||
|
|
|||
|
<p><strong>示例 2:</strong></p>
|
|||
|
|
|||
|
<pre>
|
|||
|
<strong>输入:</strong>grid = [[2]]
|
|||
|
<strong>输出:</strong>5
|
|||
|
</pre>
|
|||
|
|
|||
|
<p><strong>示例 3:</strong></p>
|
|||
|
|
|||
|
<pre>
|
|||
|
<strong>输入:</strong>[[1,0],[0,2]]
|
|||
|
<strong>输出:</strong>8
|
|||
|
</pre>
|
|||
|
|
|||
|
<p> </p>
|
|||
|
|
|||
|
<p><strong>提示:</strong></p>
|
|||
|
|
|||
|
<ul>
|
|||
|
<li><code>n == grid.length == grid[i].length</code></li>
|
|||
|
<li><code>1 <= n <= 50</code></li>
|
|||
|
<li><code>0 <= grid[i][j] <= 50</code></li>
|
|||
|
</ul>
|