哪里错了,求大神指点

var
i,j,b,c,n,max,min:longint;
t,total:int64;
a:array[-10001..10001] of integer;
begin
readln(n);
for i:=1 to n do
begin
read(c,b);
if b>max then max:=b;
if b<min then min:=b;
a[b]:=a[b]+1;
end;
total:=200000000000000;
for i:=min to max do
begin
for j:=min to max do
if a[j]>0 then
t:=t+a[j]*abs(i-j);
if t<total then total:=t;
end;
writeln(t);
end.

0 条评论

目前还没有评论...

信息

ID
1691
难度
3
分类
其他 | 排序贪心 点击显示
标签
(无)
递交数
3915
已通过
1841
通过率
47%
被复制
15
上传者