mirror of
				https://gitee.com/coder-xiaomo/leetcode-problemset
				synced 2025-11-04 11:43:12 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			48 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			48 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
<p>给你一个下标从 <strong>0</strong> 开始的整数数组 <code>nums</code> ,数组长度为 <code>n</code> 。</p>
 | 
						||
 | 
						||
<p>你可以执行无限次下述运算:</p>
 | 
						||
 | 
						||
<ul>
 | 
						||
	<li>选择一个之前未选过的下标 <code>i</code> ,并选择一个 <strong>严格小于</strong> <code>nums[i]</code> 的质数 <code>p</code> ,从 <code>nums[i]</code> 中减去 <code>p</code> 。</li>
 | 
						||
</ul>
 | 
						||
 | 
						||
<p>如果你能通过上述运算使得 <code>nums</code> 成为严格递增数组,则返回 <code>true</code> ;否则返回 <code>false</code> 。</p>
 | 
						||
 | 
						||
<p><strong>严格递增数组</strong> 中的每个元素都严格大于其前面的元素。</p>
 | 
						||
 | 
						||
<p> </p>
 | 
						||
 | 
						||
<p><strong>示例 1:</strong></p>
 | 
						||
 | 
						||
<pre>
 | 
						||
<strong>输入:</strong>nums = [4,9,6,10]
 | 
						||
<strong>输出:</strong>true
 | 
						||
<strong>解释:</strong>
 | 
						||
在第一次运算中:选择 i = 0 和 p = 3 ,然后从 nums[0] 减去 3 ,nums 变为 [1,9,6,10] 。
 | 
						||
在第二次运算中:选择 i = 1 和 p = 7 ,然后从 nums[1] 减去 7 ,nums 变为 [1,2,6,10] 。
 | 
						||
第二次运算后,nums 按严格递增顺序排序,因此答案为 true 。</pre>
 | 
						||
 | 
						||
<p><strong>示例 2:</strong></p>
 | 
						||
 | 
						||
<pre>
 | 
						||
<strong>输入:</strong>nums = [6,8,11,12]
 | 
						||
<strong>输出:</strong>true
 | 
						||
<strong>解释:</strong>nums 从一开始就按严格递增顺序排序,因此不需要执行任何运算。</pre>
 | 
						||
 | 
						||
<p><strong>示例 3:</strong></p>
 | 
						||
 | 
						||
<pre>
 | 
						||
<strong>输入:</strong>nums = [5,8,3]
 | 
						||
<strong>输出:</strong>false
 | 
						||
<strong>解释:</strong>可以证明,执行运算无法使 nums 按严格递增顺序排序,因此答案是 false 。</pre>
 | 
						||
 | 
						||
<p> </p>
 | 
						||
 | 
						||
<p><strong>提示:</strong></p>
 | 
						||
 | 
						||
<ul>
 | 
						||
	<li><code>1 <= nums.length <= 1000</code></li>
 | 
						||
	<li><code>1 <= nums[i] <= 1000</code></li>
 | 
						||
	<li><code>nums.length == n</code></li>
 | 
						||
</ul>
 |