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 caojingkun886 at 2011-07-20 16:31:32 on Problem 2350
#include<stdio.h>
main()
{
	int m,i,n,a[100],h;
	
	scanf("%d",&n);
   while(n>0)
   {double sum=0,ave=0,h=0;	
	scanf("%d",&m);
	for(i=0;i<m;i++)
   {
 scanf("%d",&a[i]);   sum=sum+a[i];
   }
 ave=sum/m;  for(i=0;i<m;i++) if(a[i]>ave) h++;
   printf("%.3f%%\n",100*(float)h/m);
 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