CUBERT - Cube Root


Your task is to calculate the cube root of a given positive integer. We can not remember why exactly we need this, but it has something in common with a princess, a young peasant, kissing and half of a kingdom (a huge one, we can assure you).

Write a program to solve this crucial task.

Input

The input starts with a line containing a single integer t <= 20, the number of test cases. t test cases follow.

The next lines consist of large positive integers of up to 150 decimal digits. Each number is on its own separate line of the input file. The input file may contain empty lines. Numbers can be preceded or followed by whitespaces but no line exceeds 255 characters.

Output

For each number in the input file your program should output a line consisting of two values separated by single space. The second value is the cube root of the given number, truncated (not rounded!) after the 10th decimal place. First value is a checksum of all printed digits of the cube root, calculated as the sum of the printed digits modulo 10.

Example

Input:
5
1

8

1000

2 33076161

Output: 1 1.0000000000 2 2.0000000000 1 10.0000000000 0 1.2599210498 6 321.0000000000

hide comments
fitcat: 2012-03-13 05:18:02

Be careful, the input contains a number with leading zeroes. This makes me a lot of WA. I don't think such kind of input is meaningful unless it is specified clearly.
Moreover, the test cases are weak. I found an AC solution that fails *a lot*.

Last edit: 2012-03-13 05:25:32
:(){ :|: & };:: 2011-03-04 02:46:12


This gave me a terrible headache very hard to solve in pyth 2.5,I managed to solve in pyth 3.1.

Phew!!!

Last edit: 2011-03-04 02:46:41
manmeet: 2010-06-03 14:55:09

I am getting wrong answer though I have used BigDecimal in JAVA

Last edit: 2010-06-03 16:08:52
Ravi Kiran: 2010-05-17 12:05:07

Got nzec in Pyth 2.5 and Ac in Pyth 2.6.2
Check for trailing and leading white spaces everywhere and blank lines too!
Phew!!Finally AC! :-)


Added by:Thanh-Vy Hua
Date:2005-01-29
Time limit:5s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: NODEJS PERL6 VB.NET
Resource:ACM South Eastern European Region 2004