题目链接

  • 题意:

    n*m的一个乘法表,从小到大排序后,输出第k个数

     (1 ≤ n, m ≤ 5·105; 1 ≤ k ≤ n·m)
  • 分析:

    对于k之前的数,排名小于k;k之后的数大于,那么就能够採用二分。
LL n, m, k;

LL fun(LL goal)
{
LL t = 0, ret = 0;
while (++t <= m)
{
ret += min(n, goal / t);
}
return ret;
} LL bin(LL L, LL R, LL goal)
{
LL M, V;
while (L <= R)
{
M = (L + R) >> 1;
V = fun(M);
if (V < goal)
L = M + 1;
else
R = M - 1;
}
return L;
} int main()
{
// freopen("in.txt", "r", stdin);
while (cin >> n >> m >> k)
{
cout << bin(1, 1e15, k) << endl;
}
return 0;
}

Codeforces Round #256 (Div. 2)——Multiplication Table的更多相关文章

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

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

  2. 贪心 Codeforces Round #273 (Div. 2) C. Table Decorations

    题目传送门 /* 贪心:排序后,当a[3] > 2 * (a[1] + a[2]), 可以最多的2个,其他的都是1个,ggr,ggb, ggr... ans = a[1] + a[2]; 或先2 ...

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

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

  4. 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 ...

  5. Codeforces Round #256 (Div. 2) D. Multiplication Table 很有想法的一个二分

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

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

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

  7. Codeforces Round #256 (Div. 2)

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

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

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

  9. CF Codeforces Round #256 (Div. 2) D (448D) Multiplication Table

    二分!!! AC代码例如以下: #include<iostream> #include<cstring> #include<cstdio> #define ll l ...

随机推荐

  1. jsoup方法string转document

    //Document doc2 = Jsoup.parseBodyFragment(element.text());                    //String FieldName=doc ...

  2. 堆栈帧的组织——C/C++内存管理必须掌握

    程序栈 说到堆栈帧,你得先说说程序栈. 记忆功能程序堆栈区是支持操作,通常共享堆. 程序栈通常占领内存区域的下部,而堆用的是上部. 程序栈存放栈帧,栈帧有时候也称为活跃记录或活跃帧.栈帧存放函数參数和 ...

  3. 流动python - 一个极简主义event制

    event至少该系统的核心,以满足: 1.存储容器事件,可以被添加到事件来删除 2.触发事件fire 守则. class Event(list): def __call__(self, *args, ...

  4. matlab 2014a 改为英文版本号

    1. 在 Matlab 的安装目录以下找到例如以下的路径,X:\MATLAB\R2014a\java\jar,当中 X 为安装盘符,这个不用过多解释了,然后找到目录 zh_CN.此目录就是中文界面的语 ...

  5. mmc生产任务分配问题

    mmc生产任务分配问题,本题目简单.

  6. 【OC加强】NSDate的使用方法——日期时间在实际开发中比較有用

    (1)日期的最主要知识点就是日期转换成字符串格式化输出,相反就是依照某个格式把字符串转换成日期. (2)一般关于时区的设置非常少用到,仅仅要了解就可以. #import <Foundation/ ...

  7. 每日回顾Shell —cat,tail,head

    Shell中常常会用到cat命令.可是总是不是特别清楚: cat命令的用途是连接文件或标准输入并打印. 这个命令经常使用来显示文件内容.或者将几个文件连接起来显示.或者从标准输入读取内容并显示,它常与 ...

  8. mysql安装注意

    mysql安装教程,网上到处都有,我这里就不细说了. 但是有一点要注意,安装完之后,点击MySql 5.5 Command Line Client时,有可能出现一闪而过,打不开mysql的情况: 首先 ...

  9. python学习笔记--for循环

    推荐一个学习语言的网站:http://www.codecademy.com 有教程,可以边学边写,蛮不错的. for循环: 1.for loops allow us to iterate throug ...

  10. altKey,ctrlKey,shiftKey

    <1> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>< ...