1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-10 18:48:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/不浪费原料的汉堡制作方案 [number-of-burgers-with-no-waste-of-ingredients].html
2022-03-29 12:43:11 +08:00

57 lines
2.2 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<p>圣诞活动预热开始啦,汉堡店推出了全新的汉堡套餐。为了避免浪费原料,请你帮他们制定合适的制作计划。</p>
<p>给你两个整数&nbsp;<code>tomatoSlices</code>&nbsp;&nbsp;<code>cheeseSlices</code>,分别表示番茄片和奶酪片的数目。不同汉堡的原料搭配如下:</p>
<ul>
<li><strong>巨无霸汉堡:</strong>4 片番茄和 1 片奶酪</li>
<li><strong>小皇堡:</strong>2 片番茄和&nbsp;1 片奶酪</li>
</ul>
<p>请你以&nbsp;<code>[total_jumbo, total_small]</code>[巨无霸汉堡总数,小皇堡总数])的格式返回恰当的制作方案,使得剩下的番茄片&nbsp;<code>tomatoSlices</code>&nbsp;和奶酪片&nbsp;<code>cheeseSlices</code>&nbsp;的数量都是&nbsp;<code>0</code></p>
<p>如果无法使剩下的番茄片&nbsp;<code>tomatoSlices</code>&nbsp;和奶酪片&nbsp;<code>cheeseSlices</code>&nbsp;的数量为&nbsp;<code>0</code>,就请返回&nbsp;<code>[]</code></p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre><strong>输入:</strong>tomatoSlices = 16, cheeseSlices = 7
<strong>输出:</strong>[1,6]
<strong>解释:</strong>制作 1 个巨无霸汉堡和 6 个小皇堡需要 4*1 + 2*6 = 16 片番茄和 1 + 6 = 7 片奶酪。不会剩下原料。
</pre>
<p><strong>示例 2</strong></p>
<pre><strong>输入:</strong>tomatoSlices = 17, cheeseSlices = 4
<strong>输出:</strong>[]
<strong>解释:</strong>只制作小皇堡和巨无霸汉堡无法用光全部原料。
</pre>
<p><strong>示例 3</strong></p>
<pre><strong>输入:</strong>tomatoSlices = 4, cheeseSlices = 17
<strong>输出:</strong>[]
<strong>解释:</strong>制作 1 个巨无霸汉堡会剩下 16 片奶酪,制作 2 个小皇堡会剩下 15 片奶酪。
</pre>
<p><strong>示例 4</strong></p>
<pre><strong>输入:</strong>tomatoSlices = 0, cheeseSlices = 0
<strong>输出:</strong>[0,0]
</pre>
<p><strong>示例 5</strong></p>
<pre><strong>输入:</strong>tomatoSlices = 2, cheeseSlices = 1
<strong>输出:</strong>[0,1]
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>0 &lt;= tomatoSlices &lt;= 10^7</code></li>
<li><code>0 &lt;= cheeseSlices &lt;= 10^7</code></li>
</ul>