0分啊!帮帮忙吧!
查看原帖
0分啊!帮帮忙吧!
1130099
William6637楼主2024/9/23 22:02
#include<bits/stdc++.h>
using namespace std;
struct timee{
	int no,ti;
};
bool cmp(timee x,timee y){
	return x.ti<y.ti;
}
int n;
timee t[1000005];
double ans;
int main(){
	cin>>n;
	for(int i=0;i<n;i++)cin>>t[i].ti;
	for(int i=0;i<n;i++)t[i].no=i+1;
	sort(t,t+n,cmp);
	for(int i=0;i<n;i++){
		for(int j=0;j<i;j++)ans+=t[j].ti;
	}
	for(int i=0;i<n;i++)cout<<t[i].no;
	cout<<endl;
	cout<<fixed<<setprecision(2)<<ans;
	return 0;
}

2024/9/23 22:02
加载中...