排序
小黑妹
穷则独善其身,达则兼济天下!
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
poj 2388 Who's in the Middle
题目大意:给出N个奇数,输出它的中间那个数。 分析:直接sort. 代码: #include #include using namespace std; int s[1000001]; int main() { int n; while(cin>>n) { for(int i=0;i<n;i++) cin>>s[i]; s原创 2012-08-16 10:11:26 · 834 阅读 · 0 评论 -
poj 2299
题意:求冒泡的交换次数。 分析:求快排的逆序数。这题直接用冒泡会超时的,虽然时间有7000MS,所以选择时间效率高的归并排序。 代码: #include #include using namespace std; int s[500010]; int left_t[500010]; int right_t[500010]; long long ct; void merge(int s[],i原创 2012-08-16 11:02:29 · 762 阅读 · 0 评论
分享