mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-11 02:58:13 +08:00
40 lines
1.3 KiB
HTML
40 lines
1.3 KiB
HTML
<p>给你四个整数数组 <code>nums1</code>、<code>nums2</code>、<code>nums3</code> 和 <code>nums4</code> ,数组长度都是 <code>n</code> ,请你计算有多少个元组 <code>(i, j, k, l)</code> 能满足:</p>
|
||
|
||
<ul>
|
||
<li><code>0 <= i, j, k, l < n</code></li>
|
||
<li><code>nums1[i] + nums2[j] + nums3[k] + nums4[l] == 0</code></li>
|
||
</ul>
|
||
|
||
<p> </p>
|
||
|
||
<p><strong>示例 1:</strong></p>
|
||
|
||
<pre>
|
||
<strong>输入:</strong>nums1 = [1,2], nums2 = [-2,-1], nums3 = [-1,2], nums4 = [0,2]
|
||
<strong>输出:</strong>2
|
||
<strong>解释:</strong>
|
||
两个元组如下:
|
||
1. (0, 0, 0, 1) -> nums1[0] + nums2[0] + nums3[0] + nums4[1] = 1 + (-2) + (-1) + 2 = 0
|
||
2. (1, 1, 0, 0) -> nums1[1] + nums2[1] + nums3[0] + nums4[0] = 2 + (-1) + (-1) + 0 = 0
|
||
</pre>
|
||
|
||
<p><strong>示例 2:</strong></p>
|
||
|
||
<pre>
|
||
<strong>输入:</strong>nums1 = [0], nums2 = [0], nums3 = [0], nums4 = [0]
|
||
<strong>输出:</strong>1
|
||
</pre>
|
||
|
||
<p> </p>
|
||
|
||
<p> <strong>提示:</strong></p>
|
||
|
||
<ul>
|
||
<li><code>n == nums1.length</code></li>
|
||
<li><code>n == nums2.length</code></li>
|
||
<li><code>n == nums3.length</code></li>
|
||
<li><code>n == nums4.length</code></li>
|
||
<li><code>1 <= n <= 200</code></li>
|
||
<li><code>-2<sup>28</sup> <= nums1[i], nums2[i], nums3[i], nums4[i] <= 2<sup>28</sup></code></li>
|
||
</ul>
|