#K36612. Maximum Shortest Distance to Water Stations
Maximum Shortest Distance to Water Stations
Maximum Shortest Distance to Water Stations
You are given a straight track of length \( N \) kilometers and are allowed to place \( M \) water stations along it. Your task is to determine the maximum possible value of the shortest distance from any kilometer mark on the track to its nearest water station, when the stations are optimally placed. In other words, if for every kilometer mark the distance to the closest water station is computed, you need to maximize the minimum of these distances.
Mathematically, the answer is \( \lceil \frac{N}{M} \rceil \), where \( \lceil x \rceil \) denotes the ceiling function (i.e. the smallest integer greater than or equal to \( x \)).
Example:
- For \( N = 10 \) and \( M = 3 \), the answer is \( 4 \) because \( \lceil 10/3 \rceil = 4 \).
- For \( N = 15 \) and \( M = 5 \), the answer is \( 3 \) because \( \lceil 15/5 \rceil = 3 \).
inputFormat
The input is provided via standard input (stdin) and consists of a single line with two space-separated integers \( N \) and \( M \), where \( N \) represents the total length of the track in kilometers and \( M \) represents the number of water stations to be placed.
outputFormat
Output a single integer to standard output (stdout) representing the maximum possible shortest distance to a water station from any kilometer on the track, computed as \( \lceil \frac{N}{M} \rceil \).
## sample10 3
4