POJ 2388 Who's in the Middle

POJ 2388 Who's in the Middle
本来想做DP专题,队长让我去补基础知识,我就来做POJ分类了……
排序。
以下是我的代码:
/*
 * Author:  lee1r
 * Created Time:  2011/8/4 20:20:15
 * File Name: poj2388.cpp
 
*/
#include
< iostream >
#include
< sstream >
#include
< fstream >
#include
< vector >
#include
< list >
#include
< deque >
#include
< queue >
#include
< stack >
#include
< map >
#include
< set >
#include
< bitset >
#include
< algorithm >
#include
< cstdio >
#include
< cstdlib >
#include
< cstring >
#include
< cctype >
#include
< cmath >
#include
< ctime >
#define  L(x) ((x)<<1)
#define  R(x) (((x)<<1)+1)
#define  Half(x) ((x)>>1)
#define  lowbit(x) ((x)&(-(x)))
using   namespace  std;
const   int  kInf( 0x7f7f7f7f );
const   double  kEps(1e - 11 );
typedef 
long   long  int64;
typedef unsigned 
long   long  uint64;

int  n,r[ 10007 ];

int  main()
{
    
// freopen("data.in","r",stdin);
    
    
while (scanf( " %d " , & n) == 1 )
    {
        
for ( int  i = 1 ;i <= n;i ++ )
            scanf(
" %d " , & r[i]);
        sort(r
+ 1 ,r + n + 1 );
        printf(
" %d\n " ,r[Half(n + 1 )]);
    }
    
    
return   0 ;
}

你可能感兴趣的:(POJ 2388 Who's in the Middle)