70482023-12-28 22:04:02IgnácKövek (100 pont)cpp17Accepted 100/10027ms4788 KiB
#include <bits/stdc++.h>
using namespace std;

int main() {
	int n;
	cin >> n;
	long long avg = 0;
	vector<int> k(n + 1);
	for (int i = 0; i < n; i++) {
		cin >> k[i];
		avg += k[i];
	}

	avg /= n;
	int ans = 0;
	for (int i = 0; i < n; i++) {
		if (k[i] != avg) ans++;
		k[i + 1] += k[i] - avg;
	}

	cout << ans;
}
SubtaskSumTestVerdictTimeMemory
base100/100
1Accepted0/03ms1848 KiB
2Accepted0/027ms2708 KiB
3Accepted5/53ms2220 KiB
4Accepted5/53ms2436 KiB
5Accepted5/53ms2912 KiB
6Accepted5/53ms3024 KiB
7Accepted5/53ms3104 KiB
8Accepted5/53ms3052 KiB
9Accepted7/73ms3184 KiB
10Accepted7/73ms3424 KiB
11Accepted8/83ms3508 KiB
12Accepted8/83ms3644 KiB
13Accepted8/83ms3736 KiB
14Accepted8/84ms3764 KiB
15Accepted8/810ms3912 KiB
16Accepted8/824ms4296 KiB
17Accepted8/827ms4788 KiB