提交时间:2024-04-10 13:42:34
运行 ID: 142853
#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; }