# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
63312 | MAMBA | Prosjek (COCI18_prosjek) | C++14 | 3 ms | 748 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |