#include<bits/stdc++.h>
using namespace std;
struct people{
int t,id;//时间 编号
}a[1001];
int n;
bool cmp(people a,people b){
return a.t<b.t;
}
int main(){
cin>>n;
for(int i=0;i<n;i++){
cin>>a[i].t;
a[i].id=i+1;
}
//将用时最短的人排在最前面
//1、排序
sort(a,a+n,cmp);
//2、输出排序后的编号
for(int i=0;i<n;i++) cout<<a[i].id<<" ";
cout<<endl;
//3、累加a[i].t * (n-i-1)获得总时间
double avg=0;//平均数
for(int i=0;i<n;i++)
avg+=a[i].t*(n-i-1) ;
printf("%.2lf\n",avg/n);//保留两位小数,立马用printf
return 0;
}
07-06
1424
03-05
236
11-30
676
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交