开始 2024-08-22 00:00:00

8.19-8.24集训第四天

结束 2024-08-26 09:00:00
Contest is over.
当前 2024-12-22 13:59:50

AC

include<bits/stdc++.h>//万能头文件

using namespace std; int main(){

int n;
cin >> n;
int a[n];
for (int i = 0 ; i < n ; i ++)
	cin >> a[i];
int ans = 0,sum = 0;
for (int i = 0 ; i < n ; i ++)
	sum += a[i];
int num = sum / n;
for (int i = 0 ; i < n ; i ++)
	a[i] -= num;
for (int i = 0 ; i < n - 1 ; i ++)
{
	if (a[i] != 0)
	{
		ans ++;
		a[i + 1] += a[i];
	}

} cout<<ans<<endl; return 0; }


zhaoyibo  •  4个月前

比赛已结束。