Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

这个程序哪里错了?

Posted by wwwwwwking at 2007-12-13 14:39:18 on Problem 2350
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator