最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

LeetCode 2769. Find the Maximum Achievable Number

2023-07-15 08:45 作者:您是打尖兒還是住店呢  | 我要投稿

You are given two integers,?num?and?t.

An integer?x?is called?achievable?if it can become equal to?num?after applying the following operation no more than?t?times:

  • Increase or decrease?x?by?1, and simultaneously increase or decrease?num?by?1.

Return?the maximum possible achievable number. It can be proven that there exists at least one achievable number.

?

Example 1:

Input: num = 4, t = 1

Output: 6

Explanation: 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.

Example 2:

Input: num = 3, t = 2

Output: 7

Explanation: 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.

?

Constraints:

  • 1 <= num, t?<= 50

????easy 題目。


Runtime:?2 ms, faster than?100.00%?of?Java?online submissions for?Find the Maximum Achievable Number.

Memory Usage:?40.8 MB, less than?12.45%?of?Java?online submissions for?Find the Maximum Achievable Number.


LeetCode 2769. Find the Maximum Achievable Number的評論 (共 條)

分享到微博請遵守國家法律
郁南县| 迭部县| 隆回县| 金湖县| 平阴县| 太和县| 正镶白旗| 新乐市| 镇沅| 芒康县| 贺兰县| 嘉峪关市| 天柱县| 海淀区| 淳化县| 西畴县| 洛扎县| 虞城县| 桃江县| 灌南县| 丹棱县| 韩城市| 新昌县| 定州市| 萨迦县| 福贡县| 马关县| 青海省| 松溪县| 土默特右旗| 韩城市| 玛曲县| 五家渠市| 彭泽县| 普格县| 夏津县| 合水县| 崇明县| 花莲市| 宝清县| 青铜峡市|