58522023-10-03 23:37:19mmatedKövek (100 pont)cpp17Accepted 100/10012ms4720 KiB
#include <bits/stdc++.h>
using namespace std;
#define f(i,k,n) for(int i=k; i<n; i++)
#define ll long long
const int inf = INT_MAX;

void solve()
{
    int n;
    cin>>n;
    int s=0;
    int a[n];
    f(i,0,n)
    {
        cin>>a[i];
        s+=a[i];
    }
    int avg=s/n;
    int ans=0;
    f(i,0,n)
    {
        if(avg!=a[i])   ans++;
        a[i+1]+=(a[i]-avg);
    }
    cout<<ans<<"\n";
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int t=1;
    //cin>>t;
    while(t--)  solve();
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base100/100
1Accepted0/03ms1888 KiB
2Accepted0/012ms2896 KiB
3Accepted5/52ms2348 KiB
4Accepted5/52ms2556 KiB
5Accepted5/52ms2792 KiB
6Accepted5/53ms2976 KiB
7Accepted5/52ms3064 KiB
8Accepted5/52ms3036 KiB
9Accepted7/73ms3248 KiB
10Accepted7/73ms3456 KiB
11Accepted8/82ms3452 KiB
12Accepted8/83ms3556 KiB
13Accepted8/83ms3468 KiB
14Accepted8/83ms3584 KiB
15Accepted8/86ms3812 KiB
16Accepted8/810ms4484 KiB
17Accepted8/810ms4720 KiB