CF#256D:http://codeforces.com/contest/448/problem/D

题意:给你一个n*m的表格,第i行第j列的数据是i*j,然后询问第k小的数,这里的排序是不去重的。

题解:二分,每次判断当前的数是第几大,然后与k进行比较。这里统计这个数是第几大,要for一遍,一开始不知道怎么统计,看了别人的知道自己傻了。这里二分的时候不用判断这个数是否在这个表中,为什么不用,自己要好好体会。

 #include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
using namespace std;
long long n,m;
long long k;
bool judge(long long x){
long long ans=,tmp;
for(long long i=;i<=n;i++){
tmp=min(i*m,x);
ans+=tmp/i;
}
return ans<k;
}
int main(){
while(~scanf("%I64d%I64d%I64d",&n,&m,&k)){
long long l=,r=n*m;
while(l<r){
long long mid=(l+r)/;
if(judge(mid))l=mid+;
else r=mid;
}
printf("%I64d\n",r);
}
}

Multiplication Table的更多相关文章

  1. hdu4951 Multiplication table (乘法表的奥秘)

    http://acm.hdu.edu.cn/showproblem.php?pid=4951 2014多校 第八题 1008 2014 Multi-University Training Contes ...

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

  3. cf448D Multiplication Table

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

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

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

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

  6. Codeforces 448 D. Multiplication Table

    二分法判断答案 D. Multiplication Table time limit per test 1 second memory limit per test 256 megabytes inp ...

  7. Codeforces 448 D. Multiplication Table 二分

    题目链接:D. Multiplication Table 题意: 给出N×M的乘法矩阵要你求在这个惩罚矩阵中第k个小的元素(1 ≤ n, m ≤ 5·10^5; 1 ≤ k ≤ n·m). 题解: n ...

  8. [LeetCode] Kth Smallest Number in Multiplication Table 乘法表中的第K小的数字

    Nearly every one have used the Multiplication Table. But could you find out the k-th smallest number ...

  9. [Swift]LeetCode668. 乘法表中第k小的数 | Kth Smallest Number in Multiplication Table

    Nearly every one have used the Multiplication Table. But could you find out the k-th smallest number ...

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

随机推荐

  1. redmine安装插件流程

    1.redmine用一键安装即可2.进入C:\Bitnami\redmine-3.1.1-1\,执行use_redmine.exe,进入dos系统 不能用cmd进入.3.把文件拷贝到C:\Bitnam ...

  2. java中的String.format使用

         format(String  format, Objece...  argues)函数相当于C语言中的printf函数,但是相对来说更灵活.      和C中的printf函数差不多,在fo ...

  3. Error parsing XML: not well-formed (invalid token) 报错+R文件消失解决的方法

    xml报错: 这个xml文件上右键source ->format 注意:res下的文件名称不能大写 R文件消失: 在攻克了其它问题的情况下(或者其它问题还没解决先凝视掉) 手动删除gen pro ...

  4. .Net Framework 4.0安装cmd命令

    在安装系统以后和.Net FrameWork 后,通过cmd编译编写的程序时总是提示编译错误.可以通过cmd命令安装相应的.net framework版本. 具体步骤如下: 1.以管理员身份打开cmd ...

  5. Android用户界面概览

    用户界面的概观           全部的Android应用程序的用户界面元素都是用View和ViewGroup对象构建的.View就是在手机屏幕上描绘一个能够与用户交互的一个对象.ViewGroup ...

  6. win7 32/64bit VS2010 OpenCV 2.4.9 环境配置

    作者 : 卿笃军 因为近期人脸识别须要用到OpenCV,让我開始了OpenCV学习. OpenCV 2.4.9下载地址:http://sourceforge.net/projects/opencvli ...

  7. spring mvc DispatcherServlet详解之前传---前端控制器架构

    前端控制器是整个MVC框架中最为核心的一块,它主要用来拦截符合要求的外部请求,并把请求分发到不同的控制器去处理,根据控制器处理后的结果,生成相应的响应发送到客户端.前端控制器既可以使用Filter实现 ...

  8. android之旅——开始

    1.文件的读取 io流读取文件,并且显示 package com.helloword; import java.io.BufferedReader; import java.io.File; impo ...

  9. shell脚本中echo显示内容带颜色

    转自:http://www.cnblogs.com/lr-ting/archive/2013/02/28/2936792.html shell脚本中echo显示内容带颜色显示,echo显示带颜色,需要 ...

  10. Tab页签切换

    js之tab页签切换效果       现在web网站,很多地都需要用到tab页签. 示例:         $(document).ready(function(){               va ...