Please enter your email address or userHandle.
You are given 2 numbers (N , M); the task is to find N√M (Nth root of M).
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. Each test case contains two space separated integers N and M.
For each test case, in a new line, print an integer denoting Nth root of M if the root is an integer else print -1.
1 <= T <= 200
2 <= N <= 20
1 <= M <= 109+5
We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?
Login to access your submissions.
Please choose 'ReadOnlyMode' if you needn't to 'Edit' the problem e.g. viewing OJ's solution, TestCase Files (TCFs), TimeLimit etc.