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 |
用double可以过的#include <iostream.h> #include <stdio.h> int c; long n; long a[1000]; int main() { cin>>c; while (c) { c--; cin>>n; int i; long sum=0; for (i=1;i<=n;i++) { cin>>a[i]; sum+=a[i]; } double xb=(double)sum/(double)n; long t=0; for (i=1;i<=n;i++) { if (a[i]>xb) t++; } xb=(double)t/(double)n*100; printf("%.3lf%c\n",xb,'%'); } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator