整个题目的数据都要为long long
#include<stdio.h>
typedef long long LL;
LL n, m, k;
LL check(LL mid)
{
LL res = 0;
for(int i = 1;i <= n;i ++)
res += ( m * i) <= mid ? m : mid / i;//关键点:枚举行,然后累加每行小于mid的数的个数
return res;
}
int main()
{
scanf("%lld %lld %lld",&n,&m,&k);
LL l = 1,r = n * m;
while(l<r)
{
LL mid = ( l + r ) >> 1;
if(check(mid) >= k) r = mid;//二分的边界点就是k
else l = mid + 1;
}
printf("%lld",l);
return 0;
}
二分就是求满足某一个性质的边界问题!!!