#K86887. Minimum Number of Rooms
Minimum Number of Rooms
Minimum Number of Rooms
You are given two integers: p representing the total number of participants and m representing the maximum room capacity. Your task is to determine the minimum number of rooms required to accommodate all participants such that the number of participants in any two rooms differ by at most one.
In other words, if we divide the total number of participants p into rooms with each room holding at most m participants, the distribution should be as equal as possible. Mathematically, if we write $$p = m \times q + r,$$ with \(0 \le r < m\), then the minimum number of rooms required is:
- If \(r = 0\), then the answer is \(q\).
- If \(r > 0\), then the answer is \(q + 1\).
For example, when p = 10 and m = 3, the answer is 4 since the participants can be distributed as: 3, 3, 2, 2.
inputFormat
The input consists of a single line containing two space-separated integers p and m where:
- 1 ≤ p ≤ 109
- 1 ≤ m ≤ 109
These represent the total number of participants and the maximum room capacity, respectively.
outputFormat
Output a single integer representing the minimum number of rooms required so that the number of participants in each room differs by at most one.
## sample10 3
4
</p>