Ron's secret message to Harry

3.8

20 votes
Problem

Harry is fed up with the Dursleys and he wants Ron to come and rescue him from 4, Privet Drive. Harry asks Ron to tell him how many days he'll still have to endure the Dursleys. Since the message from Ron can be intercepted by Uncle Vernon, Ron decides to do a bit of smart work. He cubes the number of days left and reverses the cube . However, it seems that Ron is poor at Maths! Would you help him to cube the number and reverse it? There are t test cases. For each test case, Ron will tell you the number of days after which he'll be able to rescue Harry. Display the reverse of the cube of the number of days for each test case.

Input Format: First line consists of the number of test cases ( t ). The next t lines consist of the number of days ( n ).

Output Format: t lines each showing the reverse of the cube of n.

Constraints: 1<=t<=10 0<=n<=90

Note: There won't be any trailing zeros in the cube.

Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation
  1. 16 days left - cube is 4096, thus Ron sends 6904 to Harry
  2. 81 days left - cube is 531441, thus Ron sends 144135 to Harry
  3. 4 days left - cube is 64, thus Ron sends 46 to Harry
  4. 2 days left - cube is 8, thus Ron sends 8 to Harry
Editor Image

?