409226: GYM103463 F Hsueh- Love Matrix

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

F. Hsueh- Love Matrixtime limit per test2.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

Hsueh- constructed a matrix of $$$n$$$ rows and $$$m$$$ columns, the label starts from $$$1$$$. He makes the element in the $$$i$$$-th row and $$$j$$$-th column $$$a_{i, j}$$$ equal to $$$i$$$ times $$$j$$$. i.e. $$$a_{i, j} = i \cdot j$$$. You need to find the $$$k$$$-th largest element.

Unfortunately, Hsueh- only has ten fingers, so he can't count numbers with more than ten digits. Therefore, if the answer is strictly greater than $$$9,999,999,999$$$, just output "Oops"(without quotes).

For instance, we consider $$$n = 2$$$ and $$$m = 3$$$, The matrix elements are as follows:

$$$$$$ \left[ \begin{array}{ccc} 1&2&3\\ 2&4&6 \end{array} \right] $$$$$$

  • $$$k = 1$$$, the answer is $$$6$$$.
  • $$$k = 2$$$, the answer is $$$4$$$.
  • $$$k = 3$$$, the answer is $$$3$$$.
  • $$$k = 4$$$, the answer is $$$2$$$.
  • $$$k = 5$$$, the answer is $$$2$$$.
  • $$$k = 6$$$, the answer is $$$1$$$.
Input

There are several test cases.

The first line contains a single integer $$$T(1 \leq T \leq 5)$$$, denoting the number of test cases. Then follow all the test cases.

For each test case, The first line contains three integers $$$n, m(1 \leq n, m \leq 10^9)$$$ and $$$k(1 \leq k \leq n \cdot m)$$$, representing you need to find the $$$k$$$-th largest element in $$$n$$$ rows and $$$m$$$ columns matrix.

Output

For each test case, output in one line "Oops"(without quotes) if the answer strictly greater than $$$9,999,999,999$$$, or print a single integer in one line: the $$$k$$$-th largest element of the matrix.

ExamplesInput
5
1 1 1
2 3 6
3 3 2
1 10 10
100 100 100
Output
1
1
6
1
8722
Input
1
1000000000 1000000000 1
Output
Oops

加入题单

算法标签: