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 |
为什么老是WA啊!!求大牛#include <iostream> #include <vector> #include <algorithm> using namespace std; int main() { float result; int n, i; cin >> n; vector<__int64> a(n); for ( i = 0; i < n; ++i ) { scanf("%I64d",&a[i]); } stable_sort( a.begin (), a.end () ); if ( n % 2 ) result = a[(n - 1) / 2]; else result = (a[(n / 2) - 1] + a[n / 2]) / 2.0; printf("%.1f\n", result); return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator