mirror of
				https://gitee.com/coder-xiaomo/leetcode-problemset
				synced 2025-11-04 11:43:12 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			46 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			46 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
<p>给你一个整数数组 <code>target</code> 。一开始,你有一个数组 <code>A</code> ,它的所有元素均为 1 ,你可以执行以下操作:</p>
 | 
						||
 | 
						||
<ul>
 | 
						||
	<li>令 <code>x</code> 为你数组里所有元素的和</li>
 | 
						||
	<li>选择满足 <code>0 <= i < target.size</code> 的任意下标 <code>i</code> ,并让 <code>A</code> 数组里下标为 <code>i</code> 处的值为 <code>x</code> 。</li>
 | 
						||
	<li>你可以重复该过程任意次</li>
 | 
						||
</ul>
 | 
						||
 | 
						||
<p>如果能从 <code>A</code> 开始构造出目标数组 <code>target</code> ,请你返回 True ,否则返回 False 。</p>
 | 
						||
 | 
						||
<p> </p>
 | 
						||
 | 
						||
<p><strong>示例 1:</strong></p>
 | 
						||
 | 
						||
<pre><strong>输入:</strong>target = [9,3,5]
 | 
						||
<strong>输出:</strong>true
 | 
						||
<strong>解释:</strong>从 [1, 1, 1] 开始
 | 
						||
[1, 1, 1], 和为 3 ,选择下标 1
 | 
						||
[1, 3, 1], 和为 5, 选择下标 2
 | 
						||
[1, 3, 5], 和为 9, 选择下标 0
 | 
						||
[9, 3, 5] 完成
 | 
						||
</pre>
 | 
						||
 | 
						||
<p><strong>示例 2:</strong></p>
 | 
						||
 | 
						||
<pre><strong>输入:</strong>target = [1,1,1,2]
 | 
						||
<strong>输出:</strong>false
 | 
						||
<strong>解释:</strong>不可能从 [1,1,1,1] 出发构造目标数组。
 | 
						||
</pre>
 | 
						||
 | 
						||
<p><strong>示例 3:</strong></p>
 | 
						||
 | 
						||
<pre><strong>输入:</strong>target = [8,5]
 | 
						||
<strong>输出:</strong>true
 | 
						||
</pre>
 | 
						||
 | 
						||
<p> </p>
 | 
						||
 | 
						||
<p><strong>提示:</strong></p>
 | 
						||
 | 
						||
<ul>
 | 
						||
	<li><code>N == target.length</code></li>
 | 
						||
	<li><code>1 <= target.length <= 5 * 10^4</code></li>
 | 
						||
	<li><code>1 <= target[i] <= 10^9</code></li>
 | 
						||
</ul>
 |