1 /* Accepted 1251 C++ 00:00.00 832K */
2 #include <iostream>
3
4 using namespace std;
5
6 int main()
7 {
8 int n, h[50], c = 1;
9
10 while(cin >> n && n)
11 {
12 int sum = 0;
13 for(int i = 0; i < n; i++)
14 {
15 cin >> h[i];
16 sum += h[i];
17 }
18 sum /= n;
19 int ans = 0;
20 for(int i = 0; i < n; i++)
21 ans += abs(h[i] - sum);
22 ans /= 2;
23 cout << "Set #" << c++ << endl
24 << "The minimum number of moves is " << ans << '.'
25 << endl << endl;
26 }
27
28 return 0;
29 }
30
2 #include <iostream>
3
4 using namespace std;
5
6 int main()
7 {
8 int n, h[50], c = 1;
9
10 while(cin >> n && n)
11 {
12 int sum = 0;
13 for(int i = 0; i < n; i++)
14 {
15 cin >> h[i];
16 sum += h[i];
17 }
18 sum /= n;
19 int ans = 0;
20 for(int i = 0; i < n; i++)
21 ans += abs(h[i] - sum);
22 ans /= 2;
23 cout << "Set #" << c++ << endl
24 << "The minimum number of moves is " << ans << '.'
25 << endl << endl;
26 }
27
28 return 0;
29 }
30


