| ||||||||||
| 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 | |||||||||
为什么总是错呀?那位老兄帮忙看一下#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator