#P2293. High-Precision Integer m-th Root
High-Precision Integer m-th Root
High-Precision Integer m-th Root
Your team is developing high-precision scientific calculation software. While components for high-precision addition, subtraction, multiplication, and division have been completed, the next challenge is to compute the high-precision m-th root of a natural number. Since taking the m-th root of a rational number may result in an irrational number, this task is challenging. In this first step, you are required only to compute the non-negative m-th root of a natural number and then truncate the result (i.e. remove any fractional part) so that only the integer part remains.
Mathematically, given a natural number n and an integer root degree m, you need to compute:
\( \lfloor \sqrt[m]{n} \rfloor \)
where \( \lfloor x \rfloor \) denotes the floor function that returns the largest integer less than or equal to \(x\).
inputFormat
The input consists of two natural numbers separated by space: the first number is m (the degree of the root) and the second number is n (the number to extract the m-th root from).
\(1 \leq m \leq 10\) and \(0 \leq n \leq 10^{18}\) (assumed constraints for this problem).
outputFormat
Output a single integer which is the floor (truncated) m-th root of n.
sample
2 4
2