Simple Statistics

#include <bits/stdc++.h> using namespace std; int main () { int x; cin>>x; for(int i=0;i<x;i++) { float t=0;int k,n; cin>>n>>k; int a[n]; for(int j=0;j<n;j++) { cin>>a[j]; } sort(a,a+n); for(int j=k;j<n-k;j++){ t=t+a[j]; } // cout<<t/(n-(2*k))<<endl; printf("%f\n",t/(n-(2*k))); } }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.