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

Codeforces Round #256 (Div. 2) D. Multiplication Table 很有想法的一个二分的更多相关文章

  1. Codeforces Round #256 (Div. 2) D. Multiplication Table(二进制搜索)

    转载请注明出处:viewmode=contents" target="_blank">http://blog.csdn.net/u012860063?viewmod ...

  2. Codeforces Round #256 (Div. 2) D. Multiplication Table 二分法

     D. Multiplication Table time limit per test 1 second memory limit per test 256 megabytes input st ...

  3. Codeforces Round #256 (Div. 2) D. Multiplication Table

    主题链接:http://codeforces.com/contest/448/problem/D 思路:用二分法 code: #include<cstdio> #include<cm ...

  4. Codeforces Codeforces Round #319 (Div. 2) A. Multiplication Table 水题

    A. Multiplication Table Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/57 ...

  5. Codeforces Round #256 (Div. 2) 题解

    Problem A: A. Rewards time limit per test 1 second memory limit per test 256 megabytes input standar ...

  6. Codeforces Round #256 (Div. 2)

    A - Rewards 水题,把a累加,然后向上取整(double)a/5,把b累加,然后向上取整(double)b/10,然后判断a+b是不是大于n即可 #include <iostream& ...

  7. Codeforces Round #534 (Div. 2) D. Game with modulo(取余性质+二分)

    D. Game with modulo 题目链接:https://codeforces.com/contest/1104/problem/D 题意: 这题是一个交互题,首先一开始会有一个数a,你最终的 ...

  8. Codeforces Round #256 (Div. 2) Multiplication Table

    C题, #include<cstdio> #include<cstring> #include<algorithm> #define maxn 5005 using ...

  9. Codeforces Round #256 (Div. 2)——Multiplication Table

    题目链接 题意: n*m的一个乘法表,从小到大排序后,输出第k个数  (1 ≤ n, m ≤ 5·105; 1 ≤ k ≤ n·m) 分析: 对于k之前的数,排名小于k:k之后的数大于,那么就能够採用 ...

随机推荐

  1. POI各Jar包的作用(转)

    目前POI的最新发布版本是3.10_FINAL.该版本保护的jar包有: Maven artifactId Prerequisites JAR poi commons-logging, commons ...

  2. MacBook Pro Retina 安装WIN7 - 对抗模糊及其它

    最近对虚拟机里的WIN7受够了,把整个虚拟机都删了,准备装双系统. 安装过程还是很简单的,网上教程一大堆,就是通过MAC OS X自带的BootCamp工具来管理整个安装过程,我是用外置光驱安装的,没 ...

  3. VS2012/2013引用对话框的糟糕设计

    先看两张图: 1. 首次打开引用对话框(Reference Manager),Name显示不全: (图1) 2. 然后双击或拖动splitter,让Name显示全: (图2) 3. 下次再打开引用对话 ...

  4. POI3的资料整理

    转自http://aman.cao.blog.163.com/blog/static/32951336201010823557408/ POI3的资料整理一.POI简介 Jakarta POI 是ap ...

  5. Log4j最简入门及实例

    Log4j真的很简单,简单到令人发指的地步.不是要记录日志吗?那就给你一个Log,然后你用Log来写东西就行了,先来一个完整类示例: package test; import org.apache.c ...

  6. Excel 26机制转换

    [问题描述] 在Excel中,列的名称是这样一个递增序列:A.B.C.….Z.AA.AB.AC.….AZ.BA.BB.BC.….BZ.CA.….ZZ.AAA.AAB….我们需要将上述列名序列和以下自然 ...

  7. B - Network---UVA 315(无向图求割点)

        A Telephone Line Company (TLC) is establishing a new telephone cable network. They are connectin ...

  8. Python开发【数据结构】:基础

    数据结构 什么是数据结构? 简单来说,数据结构就是设计数据以何种方式组织并存储在计算机中. 比如:列表.集合与字典等都是一种数据结构 N.Wirth: “程序=数据结构+算法” 列表 列表:在其他编程 ...

  9. linux下的进程,子进程,线程

    1.相同点:(a)二者都具有ID,一组寄存器,状态,优先级以及所要遵循的调度策略.(b) 每个进程都有一个进程控制块,线程也拥有一个线程控制块.(c) 线程和子进程共享父进程中的资源:线程和子进程独立 ...

  10. mysql 数据操作 多表查询 准备

    为什么需要多表查询: 因为我们不可能把所有数据都放在一张表里 我们把不同数据存储 放在一张一张不同表 方便管理,但我们为了方便管理,把数据拆分到一张一张表去存储. 但是数据还是一个整体,数据之间是有关 ...