提交时间:2023-12-01 13:30:30

运行 ID: 113123

#include <bits/stdc++.h> #define endl '\n' using namespace std; int a[105]; int sum, cnt, n; signed main() { cin >> n; for(int i = 1;i <= n;i++) { cin >> a[i]; sum += a[i]; } sum /= n; for(int i = 1;i <= n;i++) { if(a[i] - sum) { a[i+1] += a[i] - sum; cnt++; } } cout << cnt << endl; return 0; }