这题中的答案是怎么得出来的???急救!!

Cql_liliang Cql_liliang 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
Description
Our jeep is in the desert and we have a hard task: First we must reach a point which is N kilometers away from our camp, and then return to our camp. The terrain is tough, the car is old, and it seems like the fuel flows out, and because of this on every kilometer travelled, one litre of fuel is spent. But the jeep only has fuel tank with total capacity of M < N litres. On other hand, there is unlimited amount of fuel at our camp, and there are empty fuel tanks everywhere in the desert, these fuel tanks are large enough. When the jeep is passing near these fuel tanks, it can leave unlimited amount of fuel to them, or take unlimited amount of fuel from them to the jeep’s fuel tank.
Write a program which calculates the minimum amount of fuel in litres which is needed to reach the destination point and return to home.

Input
The input consists of multiple test cases.
The first line contains a number T, the number of the cases.
In the next T lines, every line contains two integers N and M. It is known that 5*M >= N > 0.(N <= 32000).


Output
For each test, write a single line contains the result (the minimum litres of fuel, eventually rounded up), must be written on the only line of output.


Sample Input
3
1000 2000
3000 1000
32000 6400

Sample Output
2000
226009
79145396

//5*M >= N 有什么用???
...全文
评论 1
收藏 已收藏
分享
返回顶部
Cql_liliang
C++ 语言 65,214 成员 250,514 内容