import java.util.Scanner;
public class Main
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
int n = 0;
while (true)
{
int count = sc.nextInt();
if (count == 0)
break;
int[] array = new int[count];
int sum = 0;
for (int i = 0; i < count; i++)
{
array[i] = sc.nextInt();
sum += array[i];
}
int avr = sum / count;
int result = 0;
for (int i = 0; i < count; i++)
{
if (array[i] > avr)
result += array[i] - avr;
}
System.out.format("Set #%d\nThe minimum number of moves is %d.\n\n", ++n, result);
}
}
}
ZOJ-1251
最新推荐文章于 2015-10-07 18:48:00 发布