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 |
各位帮个忙啊,我感觉没有溢出啊(内有简洁代码)#include<iostream> #include<algorithm> using namespace std; int main() { int n,i,a[250001]; float result; scanf("%d",&n); for(i=0;i<n;i++) scanf("%d",a+i); sort(a,a+n); if(n%2) result=a[(n-1)/2]; else result=a[n/2]-a[n/2-1]/2.0+a[n/2-1]; printf("%0.1f\n",result); system("pause"); } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator