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 |
你的a[]是不是应该开到1000以上?In Reply To:居然有 runtime error ?高手给点提示 Posted by:neverend at 2007-08-03 00:33:57 > #include"iostream" > using namespace std; > int main() > { > int i=0,n,count=0,m,j; > float sum,ave,a[100]; > scanf("%d",&n); > while(i<n) > { > count=0;sum=0; > i++; > scanf("%d",&m); > for( j=0;j<m;j++) > { > scanf("%f",&a[j]); > sum+=a[j]; > } > ave=sum/m; > for(j=0;j<m;j++) > if(a[j]>ave) > count++; > printf("%.3f%%\n",(float) count/m*100); > } > return 0; > } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator