Add up all h

5 + 2 + 4 + 1 + 7 + 5 = 24

divide the result with n

24 / 6 = 4

now, take each individual h and compare it with quotient.

If (hi > quotient)

count = count + (hi – quotient)

where, i denotes 1, 2, 3 … i.e. every individual h.

output: count

Critical input:

10

10 20 30 40 50 60 70 80 90 100

5

6 8 5 4 2

3

20 30 80

0

Critical output:

Set #1

The minimum number of moves is 125.

Set #2

The minimum number of moves is 4.

Set #3

The minimum number of moves is 37.

### Like this:

Like Loading...

*Related*

## Published by Shahab

Completed B.Sc in CSE, @United International University, Dhaka.
Currently working as Development Engineer, Android and iOS Application.
View all posts by Shahab

## One thought on “ACM (UVa) : 591”