D. Multiplication Table
time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

Bizon the Champion isn't just charming, he also is very smart.

While some of us were learning the multiplication table, Bizon the Champion had fun in his own manner. Bizon the Champion painted ann × m multiplication table, where the element on the intersection of the i-th row and j-th column equals i·j (the rows and columns of the table are numbered starting from 1). Then he was asked: what number in the table is the k-th largest number? Bizon the Champion always answered correctly and immediately. Can you repeat his success?

Consider the given multiplication table. If you write out all n·m numbers from the table in the non-decreasing order, then the k-th number you write out is called the k-th largest number.

Input

The single line contains integers nm and k (1 ≤ n, m ≤ 5·105; 1 ≤ k ≤ n·m).

Output

Print the k-th largest number in a n × m multiplication table.

Examples
input
2 2 2
output
2
input
2 3 4
output
3
input
1 10 5
output
5
题意:给你一个n*m的乘法表,得到第K大;
思路:对于每一行的小于等于其的数,得到个数来进行判断,n(log(n*m);
#include<bits/stdc++.h>
using namespace std;
#define ll __int64
#define mod 1000000007
#define pi (4*atan(1.0))
const int N=1e2+,M=1e6+,inf=1e9+;
int main()
{
ll x,y,z,i,t;
scanf("%I64d%I64d%I64d",&x,&y,&z);
ll st=;
ll en=x*y;
while(st<en)
{
ll mid=(st+en)>>;
ll sum=;
for(i=;i<=x;i++)
sum+=min(y,mid/i);
if(sum>=z)
en=mid;
else
st=mid+;
}
cout<<st<<endl;
return ;
}

最新文章

  1. html JS 打开本地程序及文件
  2. 走进AngularJs(四)自定义指令----(中)
  3. MySQL的外键是什么和它的作用
  4. Android的消息机制: Message/MessageQueue/Handler/Looper
  5. swift 方法
  6. oracle 分析函数(笔记)
  7. UTF-8 BOM(EF BB BF)
  8. HW5.13
  9. centos5.5上apache快速安装H264流媒体支持MP4-H264边下边播
  10. Altium Designer中使用差分对布线
  11. java.lang.OutOfMemoryError: unable to create new native thread(转)
  12. iOS中Block介绍(一)基础
  13. Android Guts: Intro to Loopers and Handlers
  14. 分针网——每日分享: jquery选择器的用法
  15. POJ2503-Babelfish-二分
  16. Spring Boot初探之restful服务发布
  17. Robust PCA via Outlier Pursuit
  18. 快速沃尔什变换(FWT)及K进制异或卷积&amp;快速子集变换(FST)讲解
  19. 结构型---外观模式(Facade Pattern)
  20. 把一个List拆分为几个大小一样的List

热门文章

  1. Windows Phone 几种弹出框提示方式
  2. 【转】stm32中断嵌套全攻略
  3. log4j.properties配置详解与实例(转载)
  4. shell 输出文件内容
  5. go 工具链目前[不支持编译 windows 下的动态链接库]解决方案
  6. Educational Codeforces Round 28
  7. 12.GIT多人协作
  8. importlib模块与__import__详解
  9. Mysql varchar 把默认值设置为null和空的区别
  10. Spring boot 开发WebService遇到的问题之一