https://www.luogu.com.cn/problem/P8647?contestId=154515
`
include<bits/stdc++.h>
define x first
define y second
using namespace std;
typedef pair<int,int>PII;
const int N=100010;
typedef long long ll;
PII p[N];
int n,k;
int find(int a){
long long sum=0;
int j;
for(j=0;j<n;j++) {
sum += (ll) ((p[j].x / a) * (p[j].y / a)); \判断条件,够分给k为小朋友
}
if(sum>=k){
return 1;
}
else{
return 0;
}
}
int main(){
cin >> n >> k;
int i;
for(i=0;i<n;i++){
cin >> p[i].x >> p[i].y;
}
int left=1;
int right=100000;
while(left<right){
int mid=(left+right+1)/2; \+1
if(find(mid)){
left=mid;
}
else{
right=mid-1; \-1
}
}
cout << left << endl;
return 0;
}
`