54362023-05-28 17:37:28AblablablaKövek (100 pont)cpp17Accepted 100/10026ms4428 KiB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    cin >> n;

    int osszeg = 0;
    vector<int> kupacok(n);

    for(int i = 0; i < n; i++){
        cin >> kupacok[i];
        osszeg += kupacok[i];
    }

    int cel = osszeg / n;
    int valasz = 0;

    for(int i = 0; i < n; i++){
        valasz += (kupacok[i] == cel ? 0 : 1);

        kupacok[i + 1] += (kupacok[i] - cel);
    }

    cout << valasz << "\n";
}
SubtaskSumTestVerdictTimeMemory
base100/100
1Accepted0/03ms1684 KiB
2Accepted0/026ms2556 KiB
3Accepted5/53ms2072 KiB
4Accepted5/53ms2452 KiB
5Accepted5/53ms2424 KiB
6Accepted5/53ms2428 KiB
7Accepted5/53ms2556 KiB
8Accepted5/53ms2796 KiB
9Accepted7/73ms2952 KiB
10Accepted7/73ms3032 KiB
11Accepted8/83ms3160 KiB
12Accepted8/83ms3616 KiB
13Accepted8/83ms3724 KiB
14Accepted8/84ms3664 KiB
15Accepted8/810ms3780 KiB
16Accepted8/823ms3904 KiB
17Accepted8/826ms4428 KiB