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 frkstyc at 2005-05-25 10:28:53 on Problem 2350
In Reply To:为什么我用了double还是wa Posted by:ageless at 2005-05-25 10:26:11
> 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