Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
我去,题目意思尚且不是很明白,看数据样例猜了一下居然一次就AC,太水了这题#include <iostream> using namespace std; int array[10000000]; int main() { int k,i,j,min,t; cin>>k; for(i=1; i<=k; i++) cin>>array[i]; for(i=1; i<=k-1; i++) { min=i; for(j=i+1; j<=k; j++) { if(array[j]<array[min]) min=j; } if(min!=i) { t=array[i]; array[i]=array[min]; array[min]=t; } } cout<<array[(k+1)/2]<<endl; return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator