28832023-02-01 18:00:04KristófKövek (100 pont)cpp11Wrong answer 0/10026ms4620 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/03ms1876 KiB
2Wrong answer0/026ms2840 KiB
3Wrong answer0/53ms2308 KiB
4Wrong answer0/53ms2832 KiB
5Wrong answer0/53ms2808 KiB
6Wrong answer0/52ms2896 KiB
7Wrong answer0/53ms2936 KiB
8Wrong answer0/53ms3288 KiB
9Wrong answer0/72ms3340 KiB
10Wrong answer0/73ms3468 KiB
11Wrong answer0/82ms3700 KiB
12Wrong answer0/83ms3584 KiB
13Wrong answer0/83ms3588 KiB
14Wrong answer0/84ms3740 KiB
15Wrong answer0/810ms4176 KiB
16Wrong answer0/823ms4440 KiB
17Wrong answer0/826ms4620 KiB