Time Limit: Java: 2000 ms / Others: 2000 ms

Memory Limit: Java: 65536 KB / Others: 65536 KB

In this problems, we'll talk about BIG numbers. Yes, I'm sorry, big numbers again....
Let N be a positive integer, we call S=NN the "big big power" of N.
In this time, I will calculate the exact value of S for a positive integer N.
Then, I tell you S, you guess N.

Note that I may make mistakes in calculating, but I promise that if I'm wrong, my result and the correct result will differ in exactly one single digit, and the number of digits is always correct(no missing or extra digits). That means, I will NOT get 'terribly wrong result' such as 3456 or 111.

The first line in the input contains a positive integer T indicating the number of test cases (1<=T<=10). Each case consists of a single line containing the exact value of S. The line does not contain any character apart from digits (0,1,2...9), and will have at most 500,000 digits. Input integers do NOT contain leading zeros.

提交代码