1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-12 19:01:47 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee

批量更新数据

This commit is contained in:
2025-01-09 20:29:41 +08:00
parent 04ecea043d
commit 48cdd06c2b
5053 changed files with 156164 additions and 135322 deletions

View File

@@ -1,35 +1,43 @@
<p>You are given two integers, <code>num</code> and <code>t</code>.</p>
<p>An integer <code>x</code> is called <b>achievable</b> if it can become equal to <code>num</code> after applying the following operation no more than <code>t</code> times:</p>
<p>Given two integers, <code>num</code> and <code>t</code>. A <strong>number </strong><code>x</code><strong> </strong>is<strong> achievable</strong> if it can become equal to <code>num</code> after applying the following operation <strong>at most</strong> <code>t</code> times:</p>
<ul>
<li>Increase or decrease <code>x</code> by <code>1</code>, and simultaneously increase or decrease <code>num</code> by <code>1</code>.</li>
<li>Increase or decrease <code>x</code> by <code>1</code>, and <em>simultaneously</em> increase or decrease <code>num</code> by <code>1</code>.</li>
</ul>
<p>Return <em>the maximum possible achievable number</em>. It can be proven that there exists at least one achievable number.</p>
<p>Return the <strong>maximum </strong>possible value of <code>x</code>.</p>
<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>
<pre>
<strong>Input:</strong> num = 4, t = 1
<strong>Output:</strong> 6
<strong>Explanation:</strong> The maximum achievable number is x = 6; it can become equal to num after performing this operation:
1- Decrease x by 1, and increase num by 1. Now, x = 5 and num = 5.
It can be proven that there is no achievable number larger than 6.
<div class="example-block">
<p><strong>Input:</strong> <span class="example-io">num = 4, t = 1</span></p>
</pre>
<p><strong>Output:</strong> <span class="example-io">6</span></p>
<p><strong>Explanation:</strong></p>
<p>Apply the following operation once to make the maximum achievable number equal to <code>num</code>:</p>
<ul>
<li>Decrease the maximum achievable number by 1, and increase <code>num</code> by 1.</li>
</ul>
</div>
<p><strong class="example">Example 2:</strong></p>
<pre>
<strong>Input:</strong> num = 3, t = 2
<strong>Output:</strong> 7
<strong>Explanation:</strong> The maximum achievable number is x = 7; after performing these operations, x will equal num:
1- Decrease x by 1, and increase num by 1. Now, x = 6 and num = 4.
2- Decrease x by 1, and increase num by 1. Now, x = 5 and num = 5.
It can be proven that there is no achievable number larger than 7.
</pre>
<div class="example-block">
<p><strong>Input:</strong> <span class="example-io">num = 3, t = 2</span></p>
<p><strong>Output:</strong> <span class="example-io">7</span></p>
<p><strong>Explanation:</strong></p>
<p>Apply the following operation twice to make the maximum achievable number equal to <code>num</code>:</p>
<ul>
<li>Decrease the maximum achievable number by 1, and increase <code>num</code> by 1.</li>
</ul>
</div>
<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>