- 顺序对的值
- 2013-12-18 12:36:15 @
program shuixudui;
var a:array[0..10000] of longint;
i,j,k,n,m,ans,p,q:longint;
begin
readln(n);
for i:=1 to n do
read(a[i]);
for i:=2 to n-1 do
begin
p:=0;
q:=0;
for j:=1 to i-1 do
if a[i]>a[j] then inc(p);
for j:=i+1 to n do
if a[i]<a[j] then inc(q);
ans:=ans+p*q;
end;
writeln(ans);
end.
1 条评论
-
Randle LV 9 @ 2017-07-24 10:43:25
枚举必死
- 1