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)/总持续时间可被 60 整除的歌曲 [pairs-of-songs-with-total-durations-divisible-by-60].html
2022-03-29 12:43:11 +08:00

34 lines
1.1 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>在歌曲列表中,第 <code>i</code> 首歌曲的持续时间为 <code>time[i]</code> 秒。</p>
<p>返回其总持续时间(以秒为单位)可被 <code>60</code> 整除的歌曲对的数量。形式上,我们希望下标数字 <code>i</code><code>j</code> 满足&nbsp; <code>i &lt; j</code> 且有&nbsp;<code>(time[i] + time[j]) % 60 == 0</code></p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre>
<strong>输入:</strong>time = [30,20,150,100,40]
<strong>输出:</strong>3
<strong>解释:</strong>这三对的总持续时间可被 60 整除:
(time[0] = 30, time[2] = 150): 总持续时间 180
(time[1] = 20, time[3] = 100): 总持续时间 120
(time[1] = 20, time[4] = 40): 总持续时间 60
</pre>
<p><strong>示例 2</strong></p>
<pre>
<strong>输入:</strong>time = [60,60,60]
<strong>输出:</strong>3
<strong>解释:</strong>所有三对的总持续时间都是 120可以被 60 整除。
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= time.length &lt;= 6 * 10<sup>4</sup></code></li>
<li><code>1 &lt;= time[i] &lt;= 500</code></li>
</ul>