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