mirror of
				https://gitee.com/coder-xiaomo/leetcode-problemset
				synced 2025-11-04 19:53:12 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			51 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			51 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
<p>给你一个整数数组 <code>nums</code>。</p>
 | 
						||
 | 
						||
<p><strong>因子得分 </strong>定义为数组所有元素的最小公倍数(LCM)与最大公约数(GCD)的<strong> 乘积</strong>。</p>
 | 
						||
 | 
						||
<p>在 <strong>最多</strong> 移除一个元素的情况下,返回 <code>nums</code> 的<strong> 最大因子得分</strong>。</p>
 | 
						||
 | 
						||
<p><strong>注意</strong>,单个数字的 <span data-keyword="lcm-function">LCM</span> 和 <span data-keyword="gcd-function">GCD</span> 都是其本身,而<strong> </strong><strong>空数组</strong> 的因子得分为 0。</p>
 | 
						||
 | 
						||
<p> </p>
 | 
						||
 | 
						||
<p><strong class="example">示例 1:</strong></p>
 | 
						||
 | 
						||
<div class="example-block">
 | 
						||
<p><strong>输入:</strong> <span class="example-io">nums = [2,4,8,16]</span></p>
 | 
						||
 | 
						||
<p><strong>输出:</strong> <span class="example-io">64</span></p>
 | 
						||
 | 
						||
<p><strong>解释:</strong></p>
 | 
						||
 | 
						||
<p>移除数字 2 后,剩余元素的 GCD 为 4,LCM 为 16,因此最大因子得分为 <code>4 * 16 = 64</code>。</p>
 | 
						||
</div>
 | 
						||
 | 
						||
<p><strong class="example">示例 2:</strong></p>
 | 
						||
 | 
						||
<div class="example-block">
 | 
						||
<p><strong>输入:</strong> <span class="example-io">nums = [1,2,3,4,5]</span></p>
 | 
						||
 | 
						||
<p><strong>输出:</strong> <span class="example-io">60</span></p>
 | 
						||
 | 
						||
<p><strong>解释:</strong></p>
 | 
						||
 | 
						||
<p>无需移除任何元素即可获得最大因子得分 60。</p>
 | 
						||
</div>
 | 
						||
 | 
						||
<p><strong class="example">示例 3:</strong></p>
 | 
						||
 | 
						||
<div class="example-block">
 | 
						||
<p><strong>输入:</strong> <span class="example-io">nums = [3]</span></p>
 | 
						||
 | 
						||
<p><strong>输出:</strong> 9</p>
 | 
						||
</div>
 | 
						||
 | 
						||
<p> </p>
 | 
						||
 | 
						||
<p><strong>提示:</strong></p>
 | 
						||
 | 
						||
<ul>
 | 
						||
	<li><code>1 <= nums.length <= 100</code></li>
 | 
						||
	<li><code>1 <= nums[i] <= 30</code></li>
 | 
						||
</ul>
 |