mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
ddd34a4f1c
2000-2099
32 lines
602 B
C++
32 lines
602 B
C++
#include <iostream>
|
|
using namespace std;
|
|
int main()
|
|
{
|
|
int n;
|
|
int a[51];
|
|
int mid;
|
|
long long sum;
|
|
bool first = true;
|
|
while(cin >> n && n)
|
|
{
|
|
sum = 0;
|
|
if(!first)
|
|
cout << endl;
|
|
for(int i = 0; i < n; i++)
|
|
{
|
|
cin >> a[i];
|
|
sum += a[i];
|
|
}
|
|
int move = 0;
|
|
mid = sum / n;
|
|
for(int i = 0; i < n; i++)
|
|
{
|
|
if(a[i] > mid)
|
|
move += a[i] - mid;
|
|
}
|
|
cout << move << endl;
|
|
first = false;
|
|
}
|
|
return 0;
|
|
}
|