|
- #include <algorithm>
- #include <iostream>
- #include <cmath>
- #include <cstring>
- #include <map>
- #include <string>
- #include <vector>
- #include <queue>
- #include <stack>
- #include <cstdio>
- #include <cstdlib>
- using namespace std;
- int n;
- double all=0;
- struct node
- {
- int v,b;
- }a[1020];
- bool cmp(node x,node y)
- {
- return x.v<y.v;
- }
- int main()
- {
- scanf("%d",&n);
- for(int i=1;i<=n;i++)
- scanf("%d",&a[i].v),a[i].b=i;
- sort(a+1,a+1+n,cmp);
- for(int i=1;i<=n;i++)
- {
- printf("%d ",a[i].b);
- all+=a[i].v*(n-i);
- }
- printf("\n%.2lf",all/n);
- return 0;
- }
复制代码 |
|