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. Oracle Database Memory Structures

    Oracle Database creates and uses memory structures for various purposes. For example, memory stores ...

  2. 02.MyBatis配置文件详解

        MyBatis入参考文档:http://mybatis.org/mybatis-3/zh/  1.properties 属性 1.在MyBatis配置文件中引用属性文件     MyBatis ...

  3. 终于修好了MacBook

    之前由于Trackpad故障,陆家嘴苹果店开了维修单,让我在2周内去更换,详见第二次去苹果店维修MacBook. 后来由于购买了AppleCare进行延保,又担心放在那维修时间长,就懒得去更换了. 昨 ...

  4. Python大数据:信用卡逾期分析

    # -*- coding:utf-8 -*- # 数据集成 import csv import numpy as np import pandas as pd import matplotlib.py ...

  5. fastBoot使用

    fastBoot使用 作者:李老师,华清远见嵌入式学院讲师. 1.1. 使用Fastboot方式烧写 在安卓手机中Fastboot是一种比Recovery更底层的刷机模式.Fastboot是一种线刷, ...

  6. Linux下批量管理工具pssh使用记录

    pssh是一款开源的软件,使用python实现,用于批量ssh操作大批量机器:pssh是一个可以在多台服务器上执行命令的工具,同时支持拷贝文件,是同类工具中很出色的:比起for循环的做法,我更推荐使用 ...

  7. Highway Project---zoj3946(最短路SPFA)

    题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=5718 题意: 有n个点 m(n,m<=10^5)条路,现在要建 ...

  8. Air Raid---hdu1151(最小路径覆盖)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1151 最小路径覆盖 == 顶点数 - 最大匹配. #include<stdio.h> #i ...

  9. 将expression转化为数据类型int时发生算术溢出错误

    在SQL Server 中,某列的数据都在int范围之内,但是使用sum聚集函数求该列和的时候,出现“将expression转化为数据类型int时发生算术溢出错误”. 问题在于定义的数据类型: 首先, ...

  10. MySQL 储存过程-原理、语法、函数详细说明

    Mysql储存过程是一组为了完成特定功能的SQL语句集,经过编译之后存储在数据库中,当需要使用该组SQL语句时用户只需要通过指定储存过程的名字并给定参数就可以调用执行它了,简而言之就是一组已经写好的命 ...