0
已解决
林炜曦
中级守护
中级守护
题目链接: 酷町堂:2927
急!2927
#include<iostream>
#include<cstdio>
#include<utility>
#include<algorithm>
using namespace std;
typedef pair<long long,int>tp;
tp a[1005];
bool cmp(tp a,tp b){return a.first<b.first;}
int sum;
int main(){
int n;
cin>>n;
for (int i=1;i<=n;i++){
scanf("%d",&a[i].first);
a[i].second=i;
}
sort(a+1,a+n+1,cmp);
for(int i=1;i<=n;i++){
for (int j=1;j<=i-1;j++){
sum+=a[j].first;
}
}
for (int i=1;i<=n;i++){
cout<<a[i].second<<" ";
}
printf("\n%.2lf",sum*1.0/n);
return 0;
}//1 2 4 6 8