#C3341. Even Distribution of Water Bottles
Even Distribution of Water Bottles
Even Distribution of Water Bottles
You are given two non-negative integers: total_bottles
and checkpoints
. Your task is to distribute the total_bottles
evenly among the checkpoints
such that the difference between the number of bottles at any two checkpoints is at most one. More formally, if you let \(b\) be the base number of water bottles each checkpoint receives, and \(r\) be the remainder when \(total\_bottles\) is divided by \(checkpoints\), then the first \(r\) checkpoints should receive \(b+1\) bottles and the remaining checkpoints should receive \(b\) bottles. If checkpoints
is zero, output We need more checkpoints!
.
Input Format: The input will contain two space-separated non-negative integers: \(total\_bottles\) and \(checkpoints\).
Output Format: If \(checkpoints = 0\), output the string We need more checkpoints!
. Otherwise, output the water bottle distribution as a sequence of integers separated by a single space.
Examples:
- Input:
20 3
→ Output:7 7 6
- Input:
8 5
→ Output:2 2 2 1 1
- Input:
15 4
→ Output:4 4 4 3
- Input:
0 0
→ Output:We need more checkpoints!
inputFormat
The input consists of a single line containing two space-separated integers: \(total\_bottles\) and \(checkpoints\), where \(0 \leq total\_bottles \leq 10^9\) and \(0 \leq checkpoints \leq 10^9\).
outputFormat
If \(checkpoints = 0\), print We need more checkpoints!
. Otherwise, print the number of water bottles at each checkpoint separated by a single space.
20 3
7 7 6