{"trustable":false,"sections":[{"title":"","value":{"format":"MD","content":"给一个序列,我们使用冒泡排序法对它进行排序。请输出在排序过程中会进行多少次交换。\n给出冒泡排序的部分代码如下:\n```c++\nvoid bubbleSort (elemType arr[], int len) {\n elemType temp;\n int i, j;\n for (i\u003d0; i\u003clen-1; i++) \n for (j\u003d0; j\u003clen-1-i; j++) { \n if (arr[j] \u003e arr[j+1]) { \n temp \u003d arr[j];\n arr[j] \u003d arr[j+1];\n arr[j+1] \u003d temp;\n }\n }\n}\n```\n"}},{"title":"Input","value":{"format":"MD","content":"多组读入,以n \u003d 0结尾,该组数据不需要处理。\n第一行给一个n**(n \u003c 5e5)**\n接下来n行有n个数a[1]~a[n],代表该序列。\n**(0 \u003c\u003d a[i] \u003c 1e9 )**"}},{"title":"Output","value":{"format":"MD","content":"输出交换次数。"}},{"title":"Sample Input","value":{"format":"MD","content":"5\n9\n1\n0\n5\n4\n3\n1\n2\n3\n0"}},{"title":"Sample Output","value":{"format":"MD","content":"6\n0"}}]}