-
个人简介
我是傻逼 #include<bits/stdc++.h> using namespace std; struct pd{ int t,id; } a[1010]; int n; bool cmp(pd a,pd b){ if(a.t==b.t) return a.id<b.id; else return a.t<b.t; } int main(){ cin>>n; for(int i=1;i<=n;i++){ cin>>a[i].t; a[i].id=i; } sort(a+1,a+1+n,cmp); int sum=0; for(int i=1;i<=n-1;i++){ sum+=a[i].t*(n-i); } for(int i=1;i<=n;i++){ cout<<a[i].id<<" "; } printf("\n%.2lf",sum*1.0/n); return 0; }
-
通过的题目
-
最近活动
This person is lazy and didn't join any contests or homework.
题目标签
- 初窥门径
- 4
- 顺序结构
- 4