NC222863. AnEasyProblem
描述
输入描述
Three integers ().
输出描述
One integer,the K-th biggest value of .
示例1
输入:
3 3 4
输出:
4
说明:
In this eaxmple, the values of all F(i,j) are 1,2,2,3,3,4,6,6,9.C++ 解法, 执行用时: 517ms, 内存消耗: 444K, 提交时间: 2022-06-04 23:11:25
#include<iostream> using namespace std; int main() { long long n,m,k,l=1,r;cin>>n>>m>>k; r=n*m; for(long long mid,sum,i;l<=r;) {mid=(l+r)/2,sum=0; for(i=1;i<=n;i++) sum+=max(0ll,m-mid/i); if(sum<k)r=mid-1; else l=mid+1; } cout<<l; }