poj 2388 快速排序

我实在是太懒了,水过吧

#include<iostream>
#include<algorithm>
using namespace std;

const int MAXN = 1E4;
int a[MAXN+1];

int main()
{
    int N;
    cin>>N;
    for(int i = 0;i<N;i++)
        cin>>a[i];
    sort(a,a+N);
    cout<<a[N/2]<<endl;
}

原文地址:https://www.cnblogs.com/ZZUGPY/p/8476308.html

时间: 2024-10-25 05:21:14

poj 2388 快速排序的相关文章

POJ 2388 Who&#39;s in the Middle(水~奇数个数排序求中位数)

题目链接:http://poj.org/problem?id=2388 题目大意: 奇数个数排序求中位数 解题思路:看代码吧! AC Code: 1 #include<stdio.h> 2 #include<algorithm> 3 using namespace std; 4 int main() 5 { 6 int n; 7 while(scanf("%d",&n)!=EOF) 8 { 9 int na[n+1]; 10 for(int i=0; i

POJ 2388.Who&#39;s in the Middle

Who's in the Middle Time Limit:1000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Submit Status Practice POJ 2388 Description FJ is surveying his herd to find the most average cow. He wants to know how much milk this 'median' cow gives

POJ 2388 Who&#39;s in the Middle 快排解法

passport.baidu.com/?business&un=%E5%B0%91%E5%A6%87%E8%8C%8C%E5%B9%B3%E5%93%AA%E6%9C%89%E6%89%BE#0 passport.baidu.com/?business&un=%E5%85%A8%E5%A5%97%E8%8E%98%E5%8E%BF%E6%89%BE%E6%9C%8D%E5%8A%A1#0 passport.baidu.com/?business&un=%E9%AB%98%E5%94

poj 2388 insert sorting

/** \brief poj 2388 insert sorting 2015 6 12 * * \param * \param * \return * */ #include <iostream> #include <cstdio> #include <cstring> using namespace std; const int N=10000; int Arr[N]; void insertSort(int len) { for(int j=1;j<len;

POJ 2388:Who&#39;s in the Middle

Who's in the Middle Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 31015   Accepted: 17991 Description FJ is surveying his herd to find the most average cow. He wants to know how much milk this 'median' cow gives: half of the cows give

POJ 2388(排序)

http://poj.org/problem?id=2388 题意:就N个数的中位数. 思路:用快排就行了.但我没用快排,我自己写了一个堆来做这个题.主要还是因为堆不怎么会,这个拿来练练手. 1 #include <stdio.h> 2 #include <string.h> 3 4 int arr[10005],ans,n; 5 6 void inset(int x,int y) //插入,并排序. 7 { 8 int i; 9 for(i = y; arr[ i / 2 ] &

POJ 2388

我不明白为何遇到这种水我竟然要犹豫一下....等会要去走亲戚,刷个水玩玩 #include <iostream> #include <cstdio> #include <algorithm> #include <cstring> using namespace std; long long a[10010]; int main() { int n; while(~scanf("%d",&n)){ memset(a,0,sizeof

POJ题目分类推荐 (很好很有层次感)

著名题单,最初来源不详.直接来源:http://blog.csdn.net/a1dark/article/details/11714009 OJ上的一些水题(可用来练手和增加自信) (POJ 3299,POJ 2159,POJ 2739,POJ 1083,POJ 2262,POJ 1503,POJ 3006,POJ 2255,POJ 3094) 初期: 一.基本算法: 枚举. (POJ 1753,POJ 2965) 贪心(POJ 1328,POJ 2109,POJ 2586) 递归和分治法. 递

POJ 刷题指南

OJ上的一些水题(可用来练手和增加自信) (POJ 3299,POJ 2159,POJ 2739,POJ 1083,POJ 2262,POJ 1503,POJ 3006,POJ 2255,POJ 3094) 初期: 一.基本算法: 枚举. (POJ 1753,POJ 2965) 贪心(POJ 1328,POJ 2109,POJ 2586) 递归和分治法. 递推. 构造法.(POJ 3295) 模拟法.(POJ 1068,POJ 2632,POJ 1573,POJ 2993,POJ 2996) 二