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

用double,double,double,double,double,double,double,double,double,double,double,double,double,double,double!!!!!!!!!!!!!!

Posted by 00448264 at 2005-05-18 18:09:12 on Problem 2350
In Reply To:这种题目为什么总是wa Posted by:00448312 at 2005-05-18 18:08:25
> # include< iostream.h >
> # include< iomanip.h >
> void main()
> {
> 	int n;
> 	int m; 
>     int a[1000];
>  
> 	cin>>n;
> 	float *b= new float[n];
> 	for( int i=0; i<n; i++ )
> 	{
> 		cin>>m;
> 		float m1=(float)m;
> 		 
> 		for( int j=0; j<m1; j++ )
> 			cin>>a[j];
>     
>         int sum=0;
> 	    for( j=0; j<m1; j++ )
> 		    sum+=a[j];
>      	float av=sum/m1;
> 	    float counter=0;
> 	    for( j=0; j<5; j++ )
> 		    if( a[j]> av )
> 			    counter++;
> 		b[i]=100*counter/m1;
> 	}
> 
> 	for( i=0; i<n; i++ )
> 		cout<<setiosflags(ios::showpoint|ios::fixed )
> 			<<setprecision(3)<<b[i]<<"%"<<endl; 
> }

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