Information
- ID
- 810
- Time
- 1000ms
- Memory
- 64MiB
- Difficulty
- 10
- Tags
- # Submissions
- 1
- Accepted
- 1
- Uploaded By
#include<bits/stdc++.h>
using namespace std;
int main()
{
int i, j, x, n, sum = 0, a[10010];
cin >> n >> x;
for(i = 1; i <= n; i++)
cin >> a[i];
for(i = 1; i <= n; i++)
for(j = 1; j <= n-i; j++)
if(a[j] > a[j+1])
swap(a[j],a[j+1]);
for(i = x+1; i <= n-x; i++)
sum += a[i];
cout << fixed << setprecision(1)<<(sum*1.0)/(n-x*2)<< endl;
return 0;
}
By signing up a 追梦算法网 universal account, you can submit code and join discussions in all online judging services provided by us.