import java.util.Scanner;
public class Q591 {
public static void main(String args[]) {
int count =0;
Scanner cin = new Scanner(System.in);
while(cin.hasNextLine() ){
String inputLine = cin.nextLine();
int size = Integer.parseInt(inputLine);
if (size==0){
break;
}
count++;
System.out.println("Set #"+count);
String tokenLine = cin.nextLine();
String[] tokens = tokenLine.split(" ");
int total =0;
int move =0;
for(int i=0; i< size;i++ ){
total += Integer.parseInt(tokens[i]);
}
for(int j=0; j< size;j++ ){
if( Integer.parseInt(tokens[j])> total/size){
move += Integer.parseInt(tokens[j]) - total/size;
}
}
System.out.println("The minimum number of moves is "+move+".\n");
}
}
}
沒有留言:
張貼留言