Nội dung Bài tập
- Mã:
- Jeep
- Tên:
- Jeep
- Dạng thi:
- acm
- Thang điểm:
- 1 điểm
- Giới hạn thời gian:
- 1 giây
- Giới hạn bộ nhớ:
- 256 MB
- Nguồn bài tập:
- Bulgarian National Olympiad Day #2
- Link nguồn:
- acm.timus.ru/problem.aspx...
- Được tạo bởi:
- thienph
Our jeep is in the desert and must reach a point which is N kilometres away from it. The terrain is tough, the car is old, and it seems like the fuel flows out, and because of this on every kilometre travelled, one litre of fuel is spent. But the jeep has fuel-cans and fuel tank with total capacity of M < N litres. On other hand, at the beginning of the road there is unlimited amount of fuel, and everywhere in the desert there are empty cisterns, in which the jeep, passing near them, can leave unlimited amount of fuel.
Write a program which calculates the minimum amount of fuel in litres which is needed to reach the destination point.
Input
Two integers N and M are written on the only line of input. It is known that 5M ≥ N > 0. (N < 32000).
Output
The result (the minimum liters of fuel, eventually rounded up), must be written on the only line of output.
Sample
input | output |
---|---|
1000 500 | 3837 |
Problem Source: Bulgarian National Olympiad Day #2
Theme :
Mời bạn soạn code
Ai có thể xem bài này :
Thông tin
Phần thảo luận