题目: |
var
n, sum, avg, cnt, i: longint;
v:array[1..101] of longint;
begin
readln(n);
avg := 0;
sum := 0;
for i := 1 to n do
begin
read(v[i]);
sum := sum + v[i];
end;
avg := sum div n;
cnt := 0;
for i := 1 to n do
begin
v[i] := v[i] - avg;
if v[i] <> 0 then
begin
inc(cnt);
v[i + 1]:= v[i + 1] + v[i];
end;
end;
writeln(cnt);
end.
输入:
7
8 9 6 17 10 13 7 输出:4
|