Submission #1089094

# Submission time Handle Problem Language Result Execution time Memory
1089094 2024-09-16T04:12:45 Z lucaskojima Prosjek (COCI18_prosjek) C++17
50 / 50
0 ms 348 KB
#include "bits/stdc++.h"
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()

using namespace std;
using ll = long long;
using pii = pair<int, int>;

const char nl = '\n';
const ll LINF = 0x3f3f3f3f3f3f3f3f;
const int INF = 0x3f3f3f3f;

int main() {
	ios::sync_with_stdio(0), cin.tie(0);

	int n; cin >> n;
	vector<int> v(n); for (auto &x : v) cin >> x;

	sort(all(v));

	double ans = 0;
	for (int i = 0; i < n - 1; i++) {
		if (i == 0) ans = (double) (v[i] + v[i + 1]) / 2;
		else ans = (double) (ans + v[i + 1]) / 2;
	}

	cout << fixed << setprecision(6) << ans << nl;
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct