比赛 20191022轻松模拟测试 评测结果 AAATTTTTTTT
题目名称 (USACO Dec18)平衡木 最终得分 27
用户昵称 liujiaqi 运行时间 8.313 s
代码语言 C++ 内存使用 5.92 MiB
提交时间 2019-10-22 17:25:39
显示代码纯文本
#include <cstdio>
#include <cstring>
#define int long long
int v, c;
template <class T> T read(T& x) {
	x = 0; v = 1; c = getchar();
	for (; c < '0' || c > '9'; c = getchar()) if (c == '-') v = -1;
	for (; c >= '0' && c <= '9'; c = getchar()) x = (x << 3) + (x << 1) + (c ^ 48);
	return x *= v;
}
template <class T> inline T max(T x, T y) {return x > y ? x : y;}
const int N = 100010;
const double EPS = 1e-16;
int n, ans;
double res, a[N], f[N];
signed main() {
	freopen("balance_beam.in", "r", stdin);
	freopen("balance_beam.out", "w", stdout);
	read(n);
	for (int i = 1; i <= n; ++i) {
		scanf("%lf", &a[i]);
	}
	for (int x = 1; x <= n; ++x) {
		f[x] = 1.0;
		for (int i = x + 1; i <= n; ++i) {
			f[i] = f[i - 1] * 0.5;
			if (f[i] < EPS) break;
		}
		for (int i = x - 1; i >= 1; --i) {
			f[i] = f[i + 1] * 0.5;
			if (f[i] < EPS) break;
		}
		res = 0.0;
		for (int i = 1; i <= n; ++i) {
			res = max(res, f[i] * a[i]);
		}
		ans = (int)(res * 1e5);
		printf("%lld\n", ans);
	}
	return 0;
}