#K37602. Budget Allocation for Impressing Her
Budget Allocation for Impressing Her
Budget Allocation for Impressing Her
Given a range ( m \leq k \leq n ) representing the total budget, determine all possible spending scenarios where you allocate money for a balloon ride and dinner such that exactly (5) dollars remain. In other words, for each total budget ( k ) in the range, find all pairs ( (b, d) ) satisfying
[ b + d + 5 = k, ]
where ( b ) is the money spent on the balloon ride and ( d ) is the money spent on dinner. For every valid scenario, print a line in the format:
B: b D: d Total: k Remaining: 5
If there are no valid scenarios within the given range, output nothing.
inputFormat
The input consists of two space-separated integers ( m ) and ( n ) on a single line, where ( m ) is the minimum total budget and ( n ) is the maximum total budget.
outputFormat
For each total budget ( k ) in the range ( [m, n] ) that can yield a valid spending scenario, output one line in the following format:
B: b D: d Total: k Remaining: 5
The scenarios for each valid ( k ) should be printed in order of increasing ( b ). If no scenarios exist, print nothing.## sample
10 10
B: 0 D: 5 Total: 10 Remaining: 5
B: 1 D: 4 Total: 10 Remaining: 5
B: 2 D: 3 Total: 10 Remaining: 5
B: 3 D: 2 Total: 10 Remaining: 5
B: 4 D: 1 Total: 10 Remaining: 5
B: 5 D: 0 Total: 10 Remaining: 5
</p>