UVa 591

From Algorithmist
Jump to navigation Jump to search

591 - Box of Bricks[edit]

Summary[edit]

Find the minimum number of moves to make all stacks of bricks the same height.

Explanation[edit]

This is a simple ad-hoc problem. We first find the final height of the stacks of bricks by computing the average, then add up the difference between the average and the stacks higher than the average.

Gotchas[edit]

  • Print a blank line after each set.

Input[edit]

6
5 2 4 1 7 5
0

Output[edit]

Set #1
The minimum number of moves is 5.


Solutions[edit]

Categories here, use the form [[Category:UVa Online Judge|591]] [[Category: Category Name]], see Categories for a list