每日·

52H1Z發表於2024-11-24

include

using namespace std;

int main() {
int n;
cin >> n;

int times[1000]; 
int order[1000];  

for (int i = 0; i < n; i++) {
    cin >> times[i];
    order[i] = i + 1;  
}


for (int i = 0; i < n - 1; i++) {
    for (int j = i + 1; j < n; j++) {
        if (times[order[i] - 1] > times[order[j] - 1]) {
            int temp = order[i];
            order[i] = order[j];
            order[j] = temp;
        }
    }
}

double tT = 0;
double ct = 0;

for (int i = 0; i < n; i++) {
    tT += ct;
    ct += times[order[i] - 1]; 
}


for (int i = 0; i < n; i++) {
    cout << order[i] << " ";
}
cout << endl;
printf("%.2f\n", tT / n);

return 0;

}