D. Multiplication Table
time limit per test

1 second

memory limit per test

256 megabytes

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.

Sample test(s)
input
2 2 2
output
2
input
2 3 4
output
3
input
1 10 5
output
5
Note

A 2 × 3 multiplication table looks like this:

1 2 3
2 4 6
/*
ID: LinKArftc
PROG: d.cpp
LANG: C++
*/ #include <map>
#include <set>
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <cstdio>
#include <string>
#include <climits>
#include <utility>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
#define eps 1e-8
#define randin srand((unsigned int)time(NULL))
#define input freopen("input.txt","r",stdin)
#define debug(s) cout << "s = " << s << endl;
#define outstars cout << "*************" << endl;
const double PI = acos(-1.0);
const double e = exp(1.0);
const int inf = 0x3f3f3f3f;
const int INF = 0x7fffffff;
typedef long long ll; ll n, m, k; ll check(ll x) {
ll ret = ;
for (int i = ; i <= n; ++ i) {
ll tmp = min(i * m, x);
ret += tmp / i;
}
return ret;
} int main() { while (~scanf("%I64d %I64d %I64d", &n, &m, &k)) {
ll l = , r = n * m;
while (l < r) {
ll mid = (l + r) >> ;
ll sum = check(mid);
if (sum >= k) r = mid;
else l = mid + ;
}
printf("%I64d\n", r);
} return ;
}

448D - Codeforces的更多相关文章

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

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

  2. Day8 - D - Multiplication Table CodeForces - 448D

    Bizon the Champion isn't just charming, he also is very smart. While some of us were learning the mu ...

  3. python爬虫学习(5) —— 扒一下codeforces题面

    上一次我们拿学校的URP做了个小小的demo.... 其实我们还可以把每个学生的证件照爬下来做成一个证件照校花校草评比 另外也可以写一个物理实验自动选课... 但是出于多种原因,,还是绕开这些敏感话题 ...

  4. 【Codeforces 738D】Sea Battle(贪心)

    http://codeforces.com/contest/738/problem/D Galya is playing one-dimensional Sea Battle on a 1 × n g ...

  5. 【Codeforces 738C】Road to Cinema

    http://codeforces.com/contest/738/problem/C Vasya is currently at a car rental service, and he wants ...

  6. 【Codeforces 738A】Interview with Oleg

    http://codeforces.com/contest/738/problem/A Polycarp has interviewed Oleg and has written the interv ...

  7. CodeForces - 662A Gambling Nim

    http://codeforces.com/problemset/problem/662/A 题目大意: 给定n(n <= 500000)张卡片,每张卡片的两个面都写有数字,每个面都有0.5的概 ...

  8. CodeForces - 274B Zero Tree

    http://codeforces.com/problemset/problem/274/B 题目大意: 给定你一颗树,每个点上有权值. 现在你每次取出这颗树的一颗子树(即点集和边集均是原图的子集的连 ...

  9. CodeForces - 261B Maxim and Restaurant

    http://codeforces.com/problemset/problem/261/B 题目大意:给定n个数a1-an(n<=50,ai<=50),随机打乱后,记Si=a1+a2+a ...

随机推荐

  1. 路由分发原则 get最终传递给get post最终传递给post

  2. 【bzoj5008】方师傅的房子 计算几何

    题目描述 给出一个凸多边形,多次询问某个点是否在这个凸多边形的内部,强制在线. 输入 第一行一个数n,接下来n行,每行两个整数x,y.输入按照逆时针顺序输入一个凸包.   接下来一个数m,最后有m行, ...

  3. Git更新github项目

    1. 把github上你想要更新修改的项目克隆到本地 $ git clone https://github.com/delav/test.git 2. 根据自己需求对项目进行修改 3. 把项目放到缓存 ...

  4. Oracle 转义字符

    id sfds_V_SF ASD_V_DSAF SD_V_DSAD   下划线是Oracle特殊字符,需要转移,如下    select * from systab t where t.id like ...

  5. UVALive.3708 Graveyard (思维题)

    UVALive.3708 Graveyard (思维题) 题意分析 这标题真悲伤,墓地. 在周长为1e4的圆周上等距分布着n个雕塑,现在要加入进来m个雕塑,最终还要使得这n+m个雕塑等距,那么原来的n ...

  6. 去掉vue 中的代码规范检测(Eslint验证)

    去掉vue 中的代码规范检测(Eslint验证): 1.在搭建vue脚手架时提示是否启用eslint检测的. Use ESLint to lint your code? 写 no; 2.如果项目已经生 ...

  7. 运行Jar包程序Shell

    启动: #!/bin/bash set -e JAVA_HOME=/usr/local/java# 检查是否有项目名 appName=$ if [ "$appName" == &q ...

  8. bzoj3810: [Coci2015]Stanovi(记忆化搜索)

    实际上切出来的矩阵在原矩阵上的位置是不重要的...重要的只有矩阵的大小和上下左右是否在边界上. 于是我们可以设f[x][y][l][r][u][d]表示x*y的矩阵上下左右是不是边界的最小代价. 记忆 ...

  9. NOIP2009 codevs1173 洛谷P1073 最优贸易

    Description: 国有 n 个大城市和 m 条道路,每条道路连接这 n 个城市中的某两个城市.任意两个城市之间最多只有一条道路直接相连.这 m 条道路中有一部分为单向通行的道路,一部分为双向通 ...

  10. 实例——简单的Samba共享

    服务端配置 # 临时停止iptables service iptables stop # 临时禁用SELinux setenforce 0 # 禁止iptables开机自动启动 chkconfig i ...