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

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

LeetCode 2739. Total Distance Traveled

2023-06-18 12:22 作者:您是打尖兒還是住店呢  | 我要投稿


A truck has two fuel tanks. You are given two integers,?mainTank?representing the fuel present in the main tank in liters and?additionalTank?representing the fuel present in the additional tank in liters.

The truck has a mileage of?10?km per liter. Whenever?5?liters of fuel get?used up in the main tank,?if the additional tank has at least?1?liters of fuel,?1?liters of fuel will be transferred from the additional tank to the main tank.

Return?the maximum distance which can be traveled.

Note:?Injection from the additional tank is not continuous. It happens suddenly and immediately for every 5 liters consumed.

?

Example 1:

Input: mainTank = 5, additionalTank = 10Output: 60Explanation: After spending 5 litre of fuel, fuel remaining is (5 - 5 + 1) = 1 litre and distance traveled is 50km. After spending another 1 litre of fuel, no fuel gets injected in the main tank and the main tank becomes empty. Total distance traveled is 60km.

Example 2:

Input: mainTank = 1, additionalTank = 2Output: 10Explanation: After spending 1 litre of fuel, the main tank becomes empty. Total distance traveled is 10km.

計(jì)算距離的,簡單題目:

Runtime:?7 ms, faster than?100.00%?of?Java?online submissions for?Total Distance Traveled.

Memory Usage:?42.7 MB, less than?100.00%?of?Java?online submissions for?Total Distance Traveled.



LeetCode 2739. Total Distance Traveled的評論 (共 條)

分享到微博請遵守國家法律
新宾| 关岭| 蕉岭县| 蒙山县| 平泉县| 明星| 泰宁县| 祁连县| 正阳县| 唐海县| 漠河县| 浦东新区| 疏附县| 合肥市| 兴文县| 浦县| 商都县| 栖霞市| 三亚市| 轮台县| 白河县| 彰武县| 若尔盖县| 安乡县| 炉霍县| 淮北市| 谢通门县| 本溪| 莒南县| 台州市| 辽中县| 新巴尔虎左旗| 呼伦贝尔市| 茶陵县| 浙江省| 阳高县| 泗洪县| 九江市| 临潭县| 安平县| 邻水|