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

为什么我用了double还是wa

Posted by ageless at 2005-05-25 10:26:11 on Problem 2350
int main()
{
	int n,m,sum,count;
	double avg;
	int i,j;
	int a[1000];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&m);
		sum=0;
		for(j=0;j<m;j++){
			scanf("%d",&a[j]);
			sum=sum+a[j];
		}
		avg=(double)sum/m;
		count=0;
		for(j=0;j<m;j++){
			if(a[j]>avg){
				count++;
			}
		}
		printf("%.3f%\n",(double)count*100/m);
	}
	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