Run ID 作者 问题 语言 测评结果 时间 内存 代码长度 提交时间
24321 我要进前十(黄泽远) 【USACO】Cow College C++ 通过 30 MS 1032 KB 266 2023-07-22 17:12:18

Tests(12/12):


#include "bits/stdc++.h" using namespace std; long long n,c[100001],cnt,ans,bns; int main(){ cin>>n; for(int i=1;i<=n;++i)cin>>c[i]; sort(c+1,c+1+n); for(int i=1;i<=n;i++){ cnt=c[i]*(n-i+1); if(cnt>ans)ans=cnt,bns=c[i]; } cout<<ans<<' '<<bns; }


测评信息: