#K93882. Count Blinking Lamp Positions
Count Blinking Lamp Positions
Count Blinking Lamp Positions
In this problem, you are given two positive integers (n) and (k). You have a row of (n) positions. Your task is to place blinking lamps in such a way that the distance between any two consecutive blinking lamps is exactly (k). A valid configuration must have at least one lamp (even if no two lamps satisfy the distance condition properly, you consider it as a valid configuration with a single lamp). The answer is defined as the number of ways to achieve such a configuration.
Mathematically, if (k \ge n), the only configuration is to place one lamp. Otherwise the number of valid positions will be (\lfloor n/k \rfloor).
inputFormat
The input consists of a single line with two space-separated integers (n) and (k).
outputFormat
Output a single integer representing the number of ways to place the blinking lamps as described.## sample
10 2
5