目录
代码
#include<bits/stdc++.h>
using namespace std;
int a[105];
int main()
{
int n, i, avg, flag, s;
avg = 0;
flag = 0;
cin >> n;
for (i = 0; i < n; i++)
{
cin >> a[i];
avg = a[i] + avg;
}
s = avg / n;
for (i = 0; i < n; i++)
{
a[i] = a[i] - s;
}
for (i = 0; i < n - 1; i++)
{
if (a[i] != 0) //如果等于0的话就不用管了;
{
a[i + 1] = a[i] + a[i + 1];
a[i] = 0;
flag++;
}
else
continue;
}
cout << flag << endl;
return 0;
}