TLE '17 Contest 7 P3 - Countless Calculator Computations

View as PDF

Submit solution


Points: 7 (partial)
Time limit: 1.0s
Java 2.0s
Python 3.0s
Memory limit: 256M

Author:
Problem type
Leon is using a very powerful calculator.

Leon likes to play with calculators whenever he gets bored in class. Such fascinating devices! One day, an intriguing problem occurred to him:

If the equation X^{X^{X^\cdots}}=Z contains Y number of X's, then given the values of Y and Z, what is the approximate value of X?

Leon is tasked with Q queries regarding this problem. Apparently, he didn't perform these countless calculator computations well enough.

Can you help him?

Input Specification

The first line contains integer Q (1 \le Q \le 20\,000), the number of queries.

The following Q lines each contain two space-separated integers Y_i (2 \le Y_i \le 100) and Z_i (1 \le Z_i \le 2^{31}-1).

Output Specification

For each query, output the approximate value of X_i on its own line, accurate within an absolute error of 10^{-5}.

For 50\% of the points, X_i may be accurate within an absolute error of 10^{-1}.

Sample Input

3
100 2
50 14
3 16

Sample Output

1.414213562
1.4484039
1.99999

Comments


  • 0
    tmago3  commented on Jan. 18, 2024, 6:51 a.m.

    how do we get the first answer