1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | #include<iostream> #include<cstdio> #include<cstring> #include<cmath> #include<string> #include<iomanip> using namespace std; int main() { int n,t,i; long long a[1000]; long long sum=0; int count=0; double per,res; cin>>t; while(t--) { cin>>n; for(i=0; i<n; i++) { cin>>a[i]; sum=sum+a[i]; } per = (float)sum/(float)n; for(i=0; i<n; i++) { if(a[i]>per) count=count+1; } res=((float)count * 100) / (float)n; cout<<setprecision(3)<<fixed<<res<<"%"<<endl; sum=0; count=0; } } |
Thursday, March 3, 2016
UVA 10370
Labels:
UVA Solution
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Thank you for commenting. Please wait for response :)