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 <stdio.h> #include <stdlib.h> int cmp(const void* e1, const void* e2); int main(void) { int n, a[1001], i, count; double sum, ave[101]; count = 0; while (scanf("%d", &n) == 1 && n) { for (i = 0; i < n; i++) scanf("%d", a + i); qsort(a, n, sizeof(int), cmp); sum = 0; for (i = 1; i < n-1; i++) sum += a[i]; ave[count++] = sum/(n - 2); } for (i = 0; i < count; i++) printf("%.0lf\n", ave[i]); return 0; } int cmp(const void* e1, const void* e2) { return (*(int*)e1) - (*(int*)e2); } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator