逆序依次为(2,2n-1),(2,2n-2),(2,2n-3).(2,1) -----------n个
(4,2n-1),(4,2n-2),(4,2n-3).(4,1) -----------n个
.
(2n,2n-1),(2n,2n-2),(2n,2n-3).(2n,1),------------n个
(2n-1,2n-2),(2n-1,2n-3).(2n-1,1)-------------n-1个
(2n-2,2n-3).(2n-2,1)-------------n-2个
.
(3,1) 1个
逆序数为1+2+3+.+n-1+n*n==n(n-1)/2+n^2=(3n^2-n)/2个