无码av一区二区三区无码,在线观看老湿视频福利,日韩经典三级片,成 人色 网 站 欧美大片在线观看

歡迎光臨散文網(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的評論 (共 條)

分享到微博請遵守國家法律
绵阳市| 恩施市| 沽源县| 宜兰市| 永川市| 屯门区| 嘉义县| 吉木萨尔县| 平度市| 寿阳县| 山西省| 嘉兴市| 七台河市| 吉林省| 东台市| 将乐县| 砀山县| 连江县| 德清县| 安泽县| 玉屏| 息烽县| 河南省| 佳木斯市| 泽州县| 英吉沙县| 舞钢市| 日照市| 瑞丽市| 平邑县| 五常市| 天全县| 左云县| 襄垣县| 镇远县| 乐平市| 曲麻莱县| 安徽省| 诏安县| 瑞昌市| 丹寨县|