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.
计算距离的,简单题目:
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.
上一篇:这个618,我把钱花在了线下
下一篇:最后一页
在竞争激烈的新能源赛道中,混合动力可以说是一个非常热门的分枝了。对消费群体来说,混合动力车型既能节省用车成本,驾乘体验也介于纯电动
早就知道今年的上海车展特别热闹,所以闲来无事,朋友也准备去上海车展凑凑热闹,结果没想到,他直接在现场消费了一台车,聊起这个事,本来
在新能源成为大势所趋的当下,无论是汽车企业还是消费群体,都对新能源车型倾注了更多兴趣和热情。这一点在刚刚开幕的上海车展上新能源车的
3月23日,中石化易捷第二届出行养车节在四川成都启动。启动仪式上,中石化易捷推出出行养车卡,为消费者提供加油满减、洗车免费、安心出行
伴随着这几年新能源市场的浮沉,消费者对新能源市场从最初的观望逐步过渡到依赖,尤其是混动车型,已经成为了大部分消费者的首选,也正因如
自今年以来,长城汽车销量被各大车企所赶超,而奇瑞也是其中之一。这是因为当下SUV市场各大品牌不断涌入,致使SUV市场达到饱和状态,促使各
中新网上海5月6日电 (记者 许婧)上海市市场监管局6日发布消息称,近日,奉贤区市场监管局接到民众举报,上海品兴农家乐专业合作社在
中新网襄阳5月6日电 (胡传林 李兴会 姚敏)湖北襄阳市气膜实验室6日建成投用,除襄阳外还将承担鄂西北地区(随州、十堰、神农架)的核
中新社武汉5月6日电 (记者 张芹)记者从6日召开的长江防汛抗旱总指挥部2022年指挥长视频会议上获悉,根据当前预测,今年汛期长江流域
中新网北京5月6日电 (徐婧)北京市委宣传部对外新闻处处长田伟在6日的疫情防控工作新闻发布会上指出,北京要有序推进区域核酸筛查,进
X 关闭
X 关闭