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 19841020 at 2006-08-16 20:58:31 on Problem 2350
#include <iostream>
#include <iomanip>
using namespace std;

int main()
{
	int n,i,c,k;
	double a[1000],sum,j;
	cin>>c;
	for(k=0;k<c;k++)
	{
		sum=0.0,j=0.0;
		cin>>n;
		for(i=0;i<n;i++)
		{	
			cin>>a[i];
			sum+=a[i];
		}
		sum=sum/n;
		for(i=0;i<n;i++)
			if(a[i]>sum)
				j++;
	
		cout.setf(ios::showpoint);
		cout << setprecision(5) << j*100/n << "%"<<endl;
	}
	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