#K7631. Minimum Steps to Markers
Minimum Steps to Markers
Minimum Steps to Markers
You are given a track of length n and a maximum step distance k. Also, a list of m markers is provided, each marking a particular position on the track. Your task is to compute the minimum number of steps required to reach each marker from the start of the track. Each step allows you to move a maximum of k units. Mathematically, for a marker at position x, the minimum number of steps required is given by the ceiling of \(\frac{x}{k}\), i.e., \(\lceil x/k \rceil\).
Note: If there are no markers, no output should be produced.
inputFormat
The first line of input contains three space separated integers: n
(the length of the track), k
(the maximum distance per step), and m
(the number of markers).
The second line contains m
space separated integers, each denoting the position of a marker.
outputFormat
Output a single line containing m
space separated integers where each integer represents the minimum number of steps required to reach the corresponding marker.
10 3 3
1 5 10
1 2 4