poj-1804 Brainman **
摘要:
/* * 逆序对-poj-1804.cpp * * 由于只能交换相邻的两个数,所以答案就是该序列的逆序对数 * * 分治, 归并排序的框架 * */#include <cstdio>using namespace std;const int maxn = 1000 + 5;int n, num[maxn], tot;int t[maxn];//通过归并排序,求num[p..q]之间的逆序对void cal(int p, int q){ if(p == q) return; int mid = (p + q) / 2; cal(p, mid); cal... 阅读全文
posted @ 2011-12-04 13:49 龙豆 阅读(328) 评论(0) 推荐(0)
浙公网安备 33010602011771号