给定一个长度为 lns="http://www.w3.org/1998/Math/MathML">nn 的数列 lns="http://www.w3.org/1998/Math/MathML">a1,a2,⋯ ,ana1,a2,⋯,an 和一个整数 lns="http://www.w3.org/1998/Math/MathML">kk。将数列 lns="http://www.w3.org/1998/Math/MathML">aa 重复 lns="http://www.w3.org/1998/Math/MathML">kk 次,得到长度为 lns="http://www.w3.org/1998/Math/MathML">n×kn×k 的循环数列 lns="http://www.w3.org/1998/Math/MathML">AA,lns="http://www.w3.org/1998/Math/MathML">AA 的正式定义如下:
如果能够找到一对整数 lns="http://www.w3.org/1998/Math/MathML">(i,j)(i,j),满足 lns="http://www.w3.org/1998/Math/MathML">i<ji<j 且 lns="http://www.w3.org/1998/Math/MathML">Ai>AjAi>Aj,则 lns="http://www.w3.org/1998/Math/MathML">(i,j)(i,j) 就是一对逆序对。请求出 lns="http://www.w3.org/1998/Math/MathML">AA 中的逆序对数量。
3 2 3 1 4
5