0
已解决
李承耀
新手光能
新手光能
题目链接: 酷町堂:2628
WA80:
#include<iostream>
using namespace std;
long long n,m,a[1005],minn=0x3f3f3f3f,maxn=-1,maxa=-1,majj,con;
int main(){
cin>>n>>m;
for(long long i=1;i<=m;i++){
cin>>a[i];
minn=min(a[i],minn);
maxn=max(a[i],maxn);
}
for(long long i=minn;i<=maxn;i++){
long long cnt=0,sum=0;
for(long long j=1;j<=m;j++){
if(a[j]>=i){
cnt++;
sum+=i;
}
}
if(sum>=majj){
maxa=cnt;
majj=sum;
}
}
cout<<majj/maxa<<" "<<majj;
}