mirror of
				https://gitee.com/coder-xiaomo/leetcode-problemset
				synced 2025-11-04 19:53:12 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			39 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			39 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
<p>给你一个整数数组 <code>nums</code>,请你找出并返回能被三整除的元素 <strong>最大和</strong>。</p>
 | 
						||
 | 
						||
<ol>
 | 
						||
</ol>
 | 
						||
 | 
						||
<p> </p>
 | 
						||
 | 
						||
<p><strong class="example">示例 1:</strong></p>
 | 
						||
 | 
						||
<pre>
 | 
						||
<strong>输入:</strong>nums = [3,6,5,1,8]
 | 
						||
<strong>输出:</strong>18
 | 
						||
<strong>解释:</strong>选出数字 3, 6, 1 和 8,它们的和是 18(可被 3 整除的最大和)。</pre>
 | 
						||
 | 
						||
<p><strong class="example">示例 2:</strong></p>
 | 
						||
 | 
						||
<pre>
 | 
						||
<strong>输入:</strong>nums = [4]
 | 
						||
<strong>输出:</strong>0
 | 
						||
<strong>解释:</strong>4 不能被 3 整除,所以无法选出数字,返回 0。
 | 
						||
</pre>
 | 
						||
 | 
						||
<p><strong class="example">示例 3:</strong></p>
 | 
						||
 | 
						||
<pre>
 | 
						||
<strong>输入:</strong>nums = [1,2,3,4,4]
 | 
						||
<strong>输出:</strong>12
 | 
						||
<strong>解释:</strong>选出数字 1, 3, 4 以及 4,它们的和是 12(可被 3 整除的最大和)。
 | 
						||
</pre>
 | 
						||
 | 
						||
<p> </p>
 | 
						||
 | 
						||
<p><strong>提示:</strong></p>
 | 
						||
 | 
						||
<ul>
 | 
						||
	<li><code>1 <= nums.length <= 4 * 10<sup>4</sup></code></li>
 | 
						||
	<li><code>1 <= nums[i] <= 10<sup>4</sup></code></li>
 | 
						||
</ul>
 |