提交时间:2023-12-12 16:17:14

运行 ID: 115629

#include<bits/stdc++.h> #define endl '\n' using namespace std; int a[105],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; return 0; }