xy_mc @ 2024-11-16 15:20:36
#include<bits/stdc++.h>
using namespace std;
int n,k,a[100005],ans,maxx;
bool check(int l){
int sum=0;
for(int i=1;i<=n;i++){
sum+=a[i]/l;
}
return sum>=k;
}
int main(){
cin>>n>>k;
for(int i=1;i<=n;i++){
cin>>a[i];
maxx=max(maxx,a[i]);
}
int l=1,r=maxx;
while(l<=r){
int mid=(l+r)>>1;
if(check(mid)){
ans=mid;
l=mid+1;
}else{
r=mid-1;
}
}
cout<<ans;
return 0;
}
by xy_mc @ 2024-11-16 17:03:04
@liuhuanjun 我叫lxc
by xy_mc @ 2024-11-16 17:09:00
@liuhuanjun 我前面艾特的你
by XURUIFAN @ 2024-11-17 09:03:58
布什戈门你这么强的啊,二分答案就入门题了,那是不是入门就能过-J一轮,多学一点-S AK啊
by sdjjdjdjdjd @ 2024-11-21 17:16:46
不是你有问题吧,评级又不是按你的标准来,要让IOI选手来直接把整个luogu变成红色你就高兴了是吧?
by taoyi20110328 @ 2024-11-22 21:52:08
@liuhuanjun资瓷
by Arabidopsis @ 2024-11-25 08:52:42
当你完成一个题时很容易觉得这个题简单,但是你写之前很可能不是这样的(((课内课外都有这个感觉