Delicious Prize
Practice
0 (0 votes)
Medium
Problem
30% Success 471 Attempts 30 Points 1s Time Limit 256MB Memory 1024 KB Max Code

Lissa has just won the HackerEarth Online Coding Contest. Kuldeep decided to offer her N chocolate boxes each containing at least one chocolate in it. But he knows that Lissa does not like chocolates very much so he wants to place chocolates in the boxes such that the total number of chocolates is minimum.

Given a number N denoting the number of boxes and a number K denoting the product of the number of chocolates in the N boxes, you need to tell Kuldeep the minimum of total number of chocolates that can be placed in the boxes.

Input:

First line of input contains an integer T denoting the total number of test cases.

Each test case consists of a single line containing two space separated integers N and K denoting the number of boxes and the product of the chocolates in n boxes.

Output:

Output consists of T lines each containing an integer denoting the minimum of total number of chocolates in the N boxes.

Constraints:

\( T \le 1000\)

\(N \le 1000\)

\(K \le 10^9\)

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:30
14 votes
Tags:
Number TheoryInteger FactorizationMathAlgorithmsNumber theory
Points:30
1 votes
Tags:
MathematicsMediumOpenApproved
Points:30
9 votes
Tags:
MediumAlgorithms