CF448D.Multiplication Table

普及+/提高

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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 an n × 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.

冠军比松不仅魅力非凡,而且非常聪明。

当一些人还在学习乘法口诀表时,冠军比松却以自己的方式自得其乐。他绘制了一张 n×mn \times m 的乘法表,其中第 ii 行与第 jj 列交叉位置上的元素等于 i⋅ji \cdot j(表格的行号与列号均从 1 开始编号)。随后有人问他:这张表中第 kk 大的数是多少?冠军比松总能立刻且准确地回答出来。你也能重现他的成功吗?

考虑给定的乘法表。若将表中全部 n⋅mn \cdot m 个数按非递减顺序写出,则所写出的第 kk 个数即称为第 kk 大的数。

输入格式

The single line contains integers n, m and k (1 ≤ n, m ≤ 5·105; 1 ≤ k ≤ n·m).

单行包含整数 nn、mm 和 kk(1 ≤ n, m ≤ 5⋅1051 ≤ n, m ≤ 5·10^5;1 ≤ k ≤ n⋅m1 ≤ k ≤ n·m)。

输出格式

Print the k-th largest number in a n × m multiplication table.

输出 n×mn \times m 乘法表中第 kk 大的数。

输入输出样例

  • 输入#1

    2 2 2

    输出#1

    2
  • 输入#2

    2 3 4

    输出#2

    3
  • 输入#3

    1 10 5

    输出#3

    5

说明/提示

A 2 × 3 multiplication table looks like this:

1 2 3
2 4 6

一个 2×32 \times 3 的乘法表如下所示:

1 2 3  
2 4 6

输入解题思路,AI测评打分。不知道怎么写?

首页