#include <bits/stdc++.h>
using namespace std;
using ld = long double;
#define sz(x) (int)x.size()
int main(){
int n;
cin >> n;
vector<int> a(n);
for(auto& i : a){
cin >> i;
}
if(n == 1){
cout << a[0];
return 0;
}
sort(a.begin(), a.end());
ld prev = ((1.0 * a[0]) + a[1]) / 2;
for(int i=2; i<n; ++i){
ld cur = (prev + a[i]) / 2;
prev = cur;
}
cout << fixed << setprecision(6) << prev;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
436 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
436 KB |
Output is correct |
6 |
Correct |
0 ms |
344 KB |
Output is correct |
7 |
Correct |
1 ms |
604 KB |
Output is correct |
8 |
Correct |
0 ms |
432 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |