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 baicaited at 2009-04-30 23:30:17 on Problem 2350
In Reply To:这几个simple太阴险了 Posted by:baicaited at 2009-04-30 23:29:25
#include"iostream"
using namespace std;
int main()
{
    int i=0,n,count=0,m,j;
	float sum,ave,a[1009];
	scanf("%d",&n);
	while(i<n)
	{
		count=0;sum=0;
		i++;
		scanf("%d",&m);
		for( j=0;j<m;j++)
		{
			scanf("%f",&a[j]);
			sum+=a[j];
		}
		ave=sum/m;
		for(j=0;j<m;j++)
			if(a[j]>ave)
				count++;
			printf("%.3f%%\n",(float) count/m*100);
	}
	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