刚做这道题根本没想到二分,最关键是没想出来怎样统计在这个矩阵中比一个数小的有几个怎么算。造成自己想了好久最后看了别人的提示才做出来。哎。好久不做题太弱了

#include<iostream>
#include<stdio.h>
using namespace std;
int main(){
// freopen("in.txt","r",stdin);
long long n,m,k;
while(cin>>n>>m>>k){
long long r=n*m,l=1,ans;
while(r>l){
long long mid=(r+l)/2;
long long t=0;
for(int i=1;i<=n;i++){//统计在这个矩阵中比一个数小的有几个
t+=min(m,mid/i);
}
if(t>=k) r=mid;
if(t<k) l=mid+1; }
cout<<r<<endl;
}
}


D. Multiplication Table 二分查找的更多相关文章

  1. Codeforces 448 D. Multiplication Table 二分

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

  2. cf448D Multiplication Table 二分

    题目:http://codeforces.com/problemset/problem/448/D 题意:给出n,m,k,即在一个n*m的二维数组中找第k大的数,第i行第j列的数的值为i*j. 思路: ...

  3. LeetCode hard 668. Kth Smallest Number in Multiplication Table(二分答案,一次过了,好开心,哈哈哈哈)

    题目:https://leetcode.com/problems/kth-smallest-number-in-multiplication-table/description/ 668. Kth S ...

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

  5. [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 ...

  6. cf448D Multiplication Table

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

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

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

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

  9. python开发学习-day04(迭代器、生成器、装饰器、二分查找、正则)

    s12-20160123-day04 *:first-child { margin-top: 0 !important; } body>*:last-child { margin-bottom: ...

随机推荐

  1. NS2学习笔记(二)

    Tcl语言 变量和变量赋值 set a "Hello World!" #将字符串赋值给变量a puts "NS2 say $a" #输出字符串的内容,其中$a表 ...

  2. JavaScript--如何插入JS

    我们来看看如何写入JS代码?你只需一步操作,使用<script>标签在HTML网页中插入JavaScript代码.注意, <script>标签要成对出现,并把JavaScrip ...

  3. windows server 2008 r2 安裝IE11

    https://support.microsoft.com/en-us/help/2847882/prerequisite-updates-for-internet-explorer-11 https ...

  4. Struts2之一 初体验

    Struts2 框架是基于MV模式开发的,它提供了一个核心控制器,用于对所有的请求进行统一处理,这个控制器是由一个名为FilterDispatcher的Servlet过滤器来充当的. 01.需要在we ...

  5. MyBatis 配置控制台上显示sql语句(log4j.properties 之三)

    ### direct log messages to stdout ###log4j.appender.stdout=org.apache.log4j.ConsoleAppenderlog4j.app ...

  6. 1B课程笔记分享_StudyJams_2017

    课程1B 概述 课程1B主要讲解了Android UI的ViewGroups(视图组).LinearLayout(线性布局).RelativeLayout(相对布局),Portrait Mode(竖屏 ...

  7. CSS——background

    背景经常用到以下属性: background-color: aliceblue; background-image: url('2017102601.png'); background-positio ...

  8. python笔记之发送邮件

    发送邮件前提:开启邮箱授权码 一.开启授权码(以163邮箱为例) 1.登录163邮箱,点击设置--POP3/SMTP/IMAP,出现设置界面   2. 开启SMTP服务且可以查询SMTP的host地址 ...

  9. C# 调用指定打印机 (并不是默认)

    this.printDocument1.PrinterSettings.PrinterName = "Microsoft XPS Document Writer"; this.pr ...

  10. Python 之re正则表达式