mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-12-18 21:31:59 +00:00
24 lines
452 B
C++
24 lines
452 B
C++
|
#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;
|
||
|
}
|