49982023-04-08 16:59:03Laci3000Kövek (100 pont)cpp11Wrong answer 20/10026ms4548 KiB

#include <vector>
#include <iostream>

using namespace std;

int beolvasas(){
	int kupacok;
	cin >> kupacok;
	vector<int>lista(kupacok);
	int kovek_szama = 0;
	for (int i = 0; i < kupacok; i++)
	{
		cin >> lista[i];
		kovek_szama += lista[i];
	}
	int celertek = kovek_szama / kupacok;

	int kulonbseg = 0;
	int a = 0;
	for (int i = 1; i < kupacok; i++)
	{
		if (lista[i - 1] != celertek) {
			kulonbseg = lista[i] - (celertek - lista[i - 1]);

			lista[i - 1] += kulonbseg;
			lista[i] -= kulonbseg;
			a++;
		}
		
	}
	return a;
}

int main()
{
	cout << beolvasas();
}

SubtaskSumTestVerdictTimeMemory
base20/100
1Wrong answer0/03ms1940 KiB
2Wrong answer0/026ms2888 KiB
3Accepted5/53ms2396 KiB
4Accepted5/53ms2592 KiB
5Accepted5/52ms2612 KiB
6Accepted5/52ms2780 KiB
7Wrong answer0/52ms2864 KiB
8Wrong answer0/53ms2988 KiB
9Wrong answer0/73ms3232 KiB
10Wrong answer0/73ms3596 KiB
11Wrong answer0/83ms3536 KiB
12Wrong answer0/83ms3664 KiB
13Wrong answer0/83ms3752 KiB
14Wrong answer0/84ms3912 KiB
15Wrong answer0/810ms3932 KiB
16Wrong answer0/823ms4032 KiB
17Wrong answer0/826ms4548 KiB