dingming 2008-09-22 06:41:00
点我顶贴
收藏
删除
var i,j,t,n,s:integer;
a:array[1..20000]of integer;
begin
read(n);s:=0;
for i:=1 to n do readln(a[i]);
for i:=1 to n-1 do
for j:=i to n do
if a[i]<a[j] then begin t:=a[i];a[i]:=a[j];a[j]:=t; end;
for i:=1 to n-1 do
for j:=i+1 to n do
if a[i]>a[j] then s:=s+1;
writeln(s);
end.
在TP里测没错啊 到这里竟然出负数?