17232022-12-01 19:28:42sarminKövek (100 pont)cpp17Accepted 100/10026ms4824 KiB
#include <bits/stdc++.h>
using namespace std;
int main() {

	int N;
	cin >> N;
	vector<int> K(N);
	int sum = 0;
	for (int i = 0; i < N; i++) {
		cin >> K[i];
		sum += K[i];
	}

	int allWill = sum / N, valami = 0;
	for (int i = 1; i < N; i++) {
		if (abs(K[i-1] - allWill) > 0 ) valami++;
		K[i] += K[i-1] - allWill;
		K[i-1] = allWill;
	}
	cout << valami;

	return 0;
}
SubtaskSumTestVerdictTimeMemory
base100/100
1Accepted0/03ms1812 KiB
2Accepted0/026ms2712 KiB
3Accepted5/52ms2208 KiB
4Accepted5/52ms2284 KiB
5Accepted5/52ms2412 KiB
6Accepted5/52ms2660 KiB
7Accepted5/52ms2856 KiB
8Accepted5/52ms2988 KiB
9Accepted7/72ms2948 KiB
10Accepted7/72ms3136 KiB
11Accepted8/82ms3276 KiB
12Accepted8/82ms3512 KiB
13Accepted8/83ms3704 KiB
14Accepted8/84ms3832 KiB
15Accepted8/810ms4024 KiB
16Accepted8/823ms4488 KiB
17Accepted8/826ms4824 KiB