28822023-02-01 17:34:35KristófKövek (100 pont)cpp11Wrong answer 0/10027ms4664 KiB
#include <iostream>

using namespace std;

int main()
{
    int n;
    cin>>n;
    int a;
    int s;
    int k[n];
    int m=0;
    for(int i=0;i<n;i++){
        cin>>k[i];
        s+=k[i];
    }
         a=s/n;
         for(int i=0;i<n;i++){
            if(k[i]>a){
                k[i+1]+=(k[i]-a);
                k[i]-=(k[i]-a);
                m++;
            }
            else if(k[i]<a){
                k[i+1]-=(a-k[i]);
                k[i]+=(a-k[i]);
                m++;
            }
         }
         cout<<m;




    return 0;
}
SubtaskSumTestVerdictTimeMemory
base0/100
1Wrong answer0/03ms1784 KiB
2Wrong answer0/027ms2796 KiB
3Wrong answer0/53ms2268 KiB
4Wrong answer0/53ms2512 KiB
5Wrong answer0/53ms2560 KiB
6Wrong answer0/53ms2776 KiB
7Wrong answer0/52ms2856 KiB
8Wrong answer0/53ms3096 KiB
9Wrong answer0/73ms3308 KiB
10Wrong answer0/72ms3376 KiB
11Wrong answer0/83ms3388 KiB
12Wrong answer0/83ms3596 KiB
13Wrong answer0/83ms3728 KiB
14Wrong answer0/84ms3824 KiB
15Wrong answer0/810ms4188 KiB
16Wrong answer0/823ms4492 KiB
17Wrong answer0/826ms4664 KiB