| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
用double,double,double,double,double,double,double,double,double,double,double,double,double,double,double!!!!!!!!!!!!!!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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator