답안 #63312

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
63312 2018-08-01T10:45:13 Z MAMBA Prosjek (COCI18_prosjek) C++14
50 / 50
3 ms 748 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define $ system("pause")
#define MOD (ll)10139
#define MAXN 200010

template<typename T> inline T smin(T &a, const T &b) { return a > b ? a = b : a; }
template<typename T> inline T smax(T &a, const T &b) { return a < b ? a = b : a; }
inline void add(ll &l, const ll &r) { l = (l + r) % MOD; }
ll gcd(ll v, ll u) { return u ? gcd(u, v % u) : v; }
ll po(ll v, ll u) { return u ? (po(v * v % MOD, u >> 1) * (u & 1 ? v : 1) % MOD) : 1; }

int n, arr[MAXN];

int main() {
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n;
	for (int i = 0; i < n; i++) cin >> arr[i];
	sort(arr, arr + n, greater<int>());
	if (n == 1) return cout << arr[0] << endl, 0;
	double answer = 0, p = 1;
	for (int i = 0; i < n; i++) {
		p /= 2;
		answer += arr[i] * p;
	}
	answer += arr[n - 1] * p;
	cout << fixed << setprecision(6) << answer << endl;
	//$;
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 248 KB Output is correct
2 Correct 3 ms 360 KB Output is correct
3 Correct 2 ms 400 KB Output is correct
4 Correct 2 ms 512 KB Output is correct
5 Correct 3 ms 516 KB Output is correct
6 Correct 3 ms 520 KB Output is correct
7 Correct 3 ms 572 KB Output is correct
8 Correct 2 ms 684 KB Output is correct
9 Correct 3 ms 748 KB Output is correct
10 Correct 3 ms 748 KB Output is correct