/** \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;j++) { int key=Arr[j]; int i=j-1; while(i>=0 && Arr[i]>key) { Arr[i+1]=Arr[i]; i=i-1; } Arr[i+1]=key; } } int main() { //cout << "Hello world!" << endl; int n; scanf("%d",&n); //while(scanf("%d",&n)) //{ memset(Arr,0,sizeof(Arr)); for(int i=0;i<n;i++) //scanf("%d",Arr[i]); cin>>Arr[i]; insertSort(n); cout<<Arr[n/2]<<endl; //} return 0; }
时间: 2024-10-20 03:14:54