Sun, 04 Aug 2019 20:46:19 +0800

master
大蒟蒻 6 years ago
parent 95dfcf2bcb
commit 80cac29649

@ -1,6 +1,25 @@
#include <bits/stdc++.h>
using namespace std;
int a[205];
int Log(int x)
{
for (int i = 0;; i++)
if ((1 << i) > x + 1)
return i;
return -1;
}
int main()
{
int n;
double k, c;
scanf("%d%lf%lf", &n, &k, &c);
for (int i = 0; i < n; i++) scanf("%d", a + i);
sort(a, a + n);
reverse(a, a + n);
int sum = 0;
double ans = 0;
for (int i = 0; i < n; i++) sum += a[i];
for (int i = 0; i < n; i++) ans += a[i] * (Log(i) * k + c);
printf("%.3lf", ans / sum);
return 0;
}

@ -0,0 +1,15 @@
2019.08.04 VERSION 0.1
You can use this article freely for learning purpose only.
Following terms should be followed.
NoDerivatives:
Partial copy and any redistribution after modification is not allowed.
If you remix, transform, or build upon this article,
you may not distribute the modified one.
NonCommercial:
You may not use this article for commercial purposes.
Exclude:
Special access right has granted to @Nonad for writing our new document.
She is allowed to bypass all the restrictions above.
Loading…
Cancel
Save