mirror of
				https://gitee.com/coder-xiaomo/leetcode-problemset
				synced 2025-11-04 03:33:12 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			38 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			38 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
<p>Given an array <code>nums</code> of positive integers. Your task is to select some subset of <code>nums</code>, multiply each element by an integer and add all these numbers. The array is said to be <strong>good </strong>if you can obtain a sum of <code>1</code> from the array by any possible subset and multiplicand.</p>
 | 
						|
 | 
						|
<p>Return <code>True</code> if the array is <strong>good </strong>otherwise return <code>False</code>.</p>
 | 
						|
 | 
						|
<p> </p>
 | 
						|
<p><strong>Example 1:</strong></p>
 | 
						|
 | 
						|
<pre>
 | 
						|
<strong>Input:</strong> nums = [12,5,7,23]
 | 
						|
<strong>Output:</strong> true
 | 
						|
<strong>Explanation:</strong> Pick numbers 5 and 7.
 | 
						|
5*3 + 7*(-2) = 1
 | 
						|
</pre>
 | 
						|
 | 
						|
<p><strong>Example 2:</strong></p>
 | 
						|
 | 
						|
<pre>
 | 
						|
<strong>Input:</strong> nums = [29,6,10]
 | 
						|
<strong>Output:</strong> true
 | 
						|
<strong>Explanation:</strong> Pick numbers 29, 6 and 10.
 | 
						|
29*1 + 6*(-3) + 10*(-1) = 1
 | 
						|
</pre>
 | 
						|
 | 
						|
<p><strong>Example 3:</strong></p>
 | 
						|
 | 
						|
<pre>
 | 
						|
<strong>Input:</strong> nums = [3,6]
 | 
						|
<strong>Output:</strong> false
 | 
						|
</pre>
 | 
						|
 | 
						|
<p> </p>
 | 
						|
<p><strong>Constraints:</strong></p>
 | 
						|
 | 
						|
<ul>
 | 
						|
	<li><code>1 <= nums.length <= 10^5</code></li>
 | 
						|
	<li><code>1 <= nums[i] <= 10^9</code></li>
 | 
						|
</ul>
 |