标签:tps end else long 很多 code ons inline 这一
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int maxn = 200005;
ll a[maxn];
ll n,k;
bool check(ll x)
{
ll cnt = 0;
for(int i=1;i<=n;i++){
cnt += (a[i]/x);
}
return cnt >= k;
}
int main()
{
cin>>n>>k;
for(int i=1;i<=n;i++)cin>>a[i];
ll l = 1 , r = 2e9 , mid;
while(l < r){
mid = (l+r)>>1;
if(check(mid))l = mid + 1;
else r = mid;
}
cout<<l - 1<<endl;
return 0;
}
标签:tps end else long 很多 code ons inline 这一
原文地址:https://www.cnblogs.com/QFNU-ACM/p/12724586.html