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<stdio.h> main() { int m,i,n,a[100],h; scanf("%d",&n); while(n>0) {double sum=0,ave=0,h=0; scanf("%d",&m); for(i=0;i<m;i++) { scanf("%d",&a[i]); sum=sum+a[i]; } ave=sum/m; for(i=0;i<m;i++) if(a[i]>ave) h++; printf("%.3f%%\n",100*(float)h/m); n--; } } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator