列表

详情


NC222863. AnEasyProblem

描述

Measuring the area of a certain shape is an important part of certain geometric problems. 

For a point  on the plane, we define the  as ,which means the area of the rectangle with the vertex.

You are given   vertex with integral coordinates in the form of ,and You need to find the K-th biggest value of ,when   .
It's guranteed that .

输入描述

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.

So the 4-th biggest value of F(i,j)_{} is 4.

原站题解

上次编辑到这里,代码来自缓存 点击恢复默认模板

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;
}

上一题