#include <bits/stdc++.h> using namespace std; struct person { int index = 0; int t = 0; }; int main() { int n; cin >> n; person p[n + 1]; double sum = 0; for (int i = 1; i <= n; i++) { cin >> p[i].t; p[i].index = i; } for (int i = 1; i <= n - 1; i++) for (int j = 1; j <= n - i; j++) { if (p[j].t > p[j + 1].t) { person t = p[j]; p[j] = p[j + 1]; p[j + 1] = t; } } double num = 0; for (int i = 1; i <= n; i++) { num = 0; for (int j = i - 1; j >= 1; j--) { num += p[j].t; } sum = sum + num; } for (int i = 1; i <= n; i++) { cout << p[i].index << " "; } printf("\n%.2f", sum / n); //平均值 return 0; }