问题标题: 酷町堂:1251

0
0
已解决
包涵宇
包涵宇
中级天翼
中级天翼

WA 20

#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<map>
#include<queue>
#include<cmath>
using namespace std;
struct cc{
    int a,m;
}b[1005]; 
int n,s;
bool cmp(cc x,cc y){
    if(x.a!=y.a)return x.a<y.a;
    return x.m<y.m;
}
int main(){
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>b[i].a;
        b[i].m=i;
    }
    sort(b+1,b+1+n,cmp);
    for(int i=1;i<=n;i++){
        cout<<b[i].m<<" ";
        s+=b[i].a*(n-i+1); 
    }
    cout<<"\n";
    printf("%.2lf",(double)(s/n));
    return 0;
}

谁能找到错误我叫他大佬


0
我要回答