萌新求助

P1223 排队接水

@[心之泪殇](/space/show?uid=85576) ```cpp #include <iostream> #include <cstdio> #include <algorithm> using namespace std; int n; double ans; struct node { int id; int time; } a[1001]; bool cmp(node x, node y) { return x.time < y.time; } int main() { cin >> n; for (int i = 1; i <= n; i++) { cin >> a[i].time; a[i].id = i; } sort(a + 1, a + n + 1, cmp); for (int i = 1; i <= n; i++) cout << a[i].id << ' '; cout << endl; for (int i = 1; i <= n; i++) { ans += a[ n-i ].time * i; } printf("%.2lf\n", (double) ans / n); return 0; } ```
by Lates @ 2019-09-06 22:17:45


@[Lates](/space/show?uid=119062) 谢谢大佬
by yi_shang @ 2019-09-06 22:18:14


唉,我现在也就只能做pj-的题
by Lates @ 2019-09-06 22:22:50


@[Lates](/space/show?uid=119062) %%%
by yi_shang @ 2019-09-06 22:28:39


@[心之泪殇](/space/show?uid=85576) 前排orz巨佬
by 绝顶我为峰 @ 2019-09-06 22:32:28


@[绝顶我为峰](/space/show?uid=85682) ~~我**为何有骂人的冲动~~
by yi_shang @ 2019-09-06 22:41:09


@[心之泪殇](/space/show?uid=85576) ~~说你是大佬还不承认真是太fAKe惹QAQ~~
by 绝顶我为峰 @ 2019-09-06 22:43:21


|