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

Re:这题不是多case……

Posted by qylsw at 2010-07-09 20:04:00 on Problem 2350
In Reply To:这题不是多case…… Posted by:karying at 2010-05-06 22:06:44
> 我用多case,居然是WA……
#include<iostream>
using namespace std;
int main()
{
	int x;
	scanf("%d",&x);
	while(x--){
		int n,a[1000],i,j,count=0,t=0;
		scanf("%d",&n);
		for(i=0;i<n;i++){
			cin>>a[i];
			t+=a[i];
		}
		double all=t,count1;
		all/=n;
		for(j=0;j<n;j++)
		 	if(a[j]>all) count+=1;
			count1=count*100;
		 	printf("%.3lf%c\n",count1/n,'%');
	}
	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