mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-10 18:48:13 +08:00
34 lines
1.1 KiB
HTML
34 lines
1.1 KiB
HTML
<p>在歌曲列表中,第 <code>i</code> 首歌曲的持续时间为 <code>time[i]</code> 秒。</p>
|
||
|
||
<p>返回其总持续时间(以秒为单位)可被 <code>60</code> 整除的歌曲对的数量。形式上,我们希望下标数字 <code>i</code> 和 <code>j</code> 满足 <code>i < j</code> 且有 <code>(time[i] + time[j]) % 60 == 0</code>。</p>
|
||
|
||
<p> </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> </p>
|
||
|
||
<p><strong>提示:</strong></p>
|
||
|
||
<ul>
|
||
<li><code>1 <= time.length <= 6 * 10<sup>4</sup></code></li>
|
||
<li><code>1 <= time[i] <= 500</code></li>
|
||
</ul>
|