ac

逸尘  •  1年前


include<bits/stdc++.h>

using namespace std; struct person{

int time,z;	

}; bool cmp(person x,person y){

return x.time<y.time;

} int main(){

int n;
float p=0;
cin>>n;
person a[n+5];
for(int i=1;i<=n;i++){
	cin>>a[i].time;
	a[i].z=i;
}
sort(a+1,a+1+n,cmp);
for(int i=1;i<=n;i++){
	cout<<a[i].z<<' ';
	p+=(n-i)*a[i].time;
}
cout<<endl;
p/=n;
printf("%.2f",p);
return 0;

}


评论:

请先登录,才能进行评论