2018年1月13日 星期六

UVA Q10370 - Above Average

#include<iostream>
#include<cmath>
#include<iomanip>
using namespace std;
int main(){
int a,b,c[1000];
double d,e,f;
cin>>a;
for(int x=1;x<=a;x++){
    cin>>b;
    f=0;
    for(int y=0;y<b;y++){
        cin>>c[y];
        d=d+c[y];
    }
    d=d/b;
    for(int y=0;y<b;y++){
        if(c[y]>d){
            f++;
        }
    }
    e=f/b*100;//(¹FŒÐ/Á`€HŒÆ)*100%
    cout<<setprecision(3)<<fixed<<e<<"%"<<endl;
}

system ("pause");
return 0;
}

沒有留言:

張貼留言