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 tcxgsy at 2005-08-08 13:01:03 on Problem 2350
In Reply To:Re:为什么会出现Compile Error Posted by:tcxgsy at 2005-08-08 13:00:14
#define M 1001
#include"stdio.h"
#include"math.h"

double aver(int a[M],int m)
{ 
   long sum=0;
   double aver;
   int i,j=0;
  for(i=1;i<=m;i++)
    sum+=a[i];
     aver=sum/m;
     for(i=1;i<=m;i++)
      if(a[i]>aver)  j++;
   m=(double)j/(double)m;
   return(m*100);
}
main()
{ int n,m,i;
  int a[M];
  double d;
  scanf("%d",&n);
  while(n)
   {   scanf("%d"&m);
        for(i=1;i<=m;i++)
          scanf("%d",&a[i]);
     d=aver(a,m);
     printf("%.3lf%c\n",d,'%');
      n--;
     }
}

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