| Run ID | 作者 | 问题 | 语言 | 测评结果 | 时间 | 内存 | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 75221 | sh25_ganzy | [贪心算法]排队接水 | C++ | 通过 | 0 MS | 252 KB | 660 | 2025-12-05 15:33:32 |
// // main.cpp // Water containing // // Created by Leonardo Cullen on 2017/5/6. // Copyright © 2017年 Leonardo Cullen. All rights reserved. // #include <iostream> #include <cstdio> #include <algorithm> using namespace std; double sum; long int n; long long int t[1001]; double ans; int main(int argc, const char * argv[]) { cin>>n; int x; for(int i=1;i<=n;i++) { cin>>x; t[i]=x*1001+i; } sort(t+1,t+1+n); for(int j=1;j<=n;j++) { cout<<t[j]%1001<<" "; sum+=t[j]/1001*(n-j); } cout<<endl; ans=sum/n; printf("%0.2lf",ans); return 0; }