#include<iostream>
using namespace std;
#include<algorithm>
int get(int a, int b)
{
int l = 1, r = 1e9 + 1;
while (l < r)
{
int mid = l + r >> 1;
if (a / mid <= b) r = mid;
else l = mid + 1;
}
return r;
}
int main()
{
int n;
cin >> n;
int a, b;
int v_min = 1, v_max = 1e9;
while (n--)
{
cin >> a >> b;
v_min = max(v_min, get(a, b));
v_max = min(v_max, get(a, b - 1) - 1);
}
cout << v_min << " " << v_max << endl;
}
标签:get,int,max,每日,min,mid,打卡
From: https://www.cnblogs.com/gyg1222/p/17323022.html