标签:
Time Limit: 1000MS | Memory Limit: 65536K | |
Total Submissions: 15792 | Accepted: 4409 |
Description
Input
Output
Sample Input
4 3 6 4 5
Sample Output
4.5
Hint
1 #include <cstdio> 2 #include <algorithm> 3 4 using namespace std; 5 6 int main() 7 { 8 long long a[250005]; 9 int n; 10 scanf("%d", &n); 11 for(int i = 0; i < n; i++) 12 { 13 scanf("%lld", &a[i]); 14 } 15 sort(a, a + n); 16 if(n & 1) 17 { 18 printf("%lld.0\n", a[n / 2]); 19 } 20 else 21 { 22 long long sum = a[n / 2] + a[n / 2 - 1]; 23 printf("%lld", sum / 2); 24 if(sum & 1) 25 { 26 printf(".5\n"); 27 } 28 else 29 { 30 printf(".0\n"); 31 } 32 } 33 34 return 0; 35 }
标签:
原文地址:http://www.cnblogs.com/codingpenguin/p/4293950.html