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

Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig
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^{X^{\ .\ .\ .}}}}=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

100 2
50 14
3 16

Sample Output



There are no comments at the moment.