闲的没事干, 写了个计算逆序数的简单代码
#include <stdio.h>int main(void)
{
int a[6] = {34, 8, 64, 51, 32, 21};
int i, j, count;
count = 0;
for (i = 1; i < 6; i++)
{
for (j = 0; j < i; j++)
{
if (a[j] > a[i])
{
count++;
}
}
}
printf("%d", count);
getchar();
return 0;
}