0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-24 03:31:59 +00:00

P1223 排队接水

R52646721
This commit is contained in:
Baoshuo Ren 2021-07-08 20:35:37 +08:00 committed by Baoshuo Ren
parent f8347749c5
commit a3111a3ae1
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68

View File

@ -0,0 +1,23 @@
#include <bits/stdc++.h>
using namespace std;
int n;
double sum = 0.00;
pair<int, int> a[1005];
int main() {
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> a[i].first;
a[i].second = i;
}
sort(a + 1, a + 1 + n);
for (int i = 1; i <= n; i++) {
cout << a[i].second << ' ';
sum += a[i].first * (n - i);
}
cout << endl;
cout << fixed << setprecision(2) << sum / n << endl;
return 0;
}