#include<bits/stdc++.h>
using namespace std;
const int maxn = 114514;
struct stu{
int t;
int id;
}a[maxn];
bool cmp(stu a, stu b){
if(a.t != b.t){
return a.t < b.t;
}
return a.id < b.id;
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n;
double sum = 0;
scanf("%d", &n);
for(int i = 1; i <= n; i++){
cin >> a[i].t;
a[i].id = i;
}
sort(a+1, a+n+1, cmp);
for(int i = 1; i < n; i++){
printf("%d ", a[i].id);
sum += i*a[n-i].t;
}
printf("%d\n", a[n].id);
printf("%.2f", sum/n);
return 0;
}
本地c++输出:3 2 7 8 9 6 10 5
291.90
此处输出:1 2 3 4 5 6 7 8 9 10
0.00
【无奈的笑了:/】