#K56842. Maximizing Distance Between Customers
Maximizing Distance Between Customers
Maximizing Distance Between Customers
You are given two integers \(n\) and \(k\), representing the total number of seats and the number of customers respectively. Your task is to determine the maximum distance between two adjacent customers when the customers are seated optimally.
The optimal strategy is as follows:
Let \(D = \lfloor n/k \rfloor\) be the base distance if the seats were evenly distributed. If there is a remainder (i.e. \(n \mod k > 0\)), then some distances will be \(D+1\) instead. In such cases, the maximum distance between two adjacent customers is \(D+1\); otherwise it is \(D\).
For example, if \(n = 10\) and \(k = 3\), then \(D = 3\) and since \(10 \mod 3 = 1 > 0\), the answer is \(3+1 = 4\).
inputFormat
The input consists of a single line containing two space-separated integers (n) and (k), where (n) is the total number of seats and (k) is the number of customers.
outputFormat
Output a single integer representing the maximum distance between two adjacent customers, when the customers are seated optimally.## sample
10 3
4