- 题解
- 2020-02-07 22:27:59 @
留坑待填
#include <cstdio>
#include <iostream>
#include <cmath>
#define MAXN 10010
int n;
int decks[MAXN];
bool is_valid(int x) {
return x >= 0 && x < n;
}
int main() {
scanf("%d", &n);
int sum = 0;
for(int i = 0;i < n;++i) {
scanf("%d", decks+i);
sum += decks[i];
}
int ave = sum / n;
int cnt = 0;
for(int i = 0;i < n - 1;++i) {
decks[i+1] += decks[i] - ave;
cnt += abs(decks[i] - ave) > 0 ? 1 : 0;
}
printf("%d", cnt);
return 0;
}
0 条评论
目前还没有评论...