Submit | All submissions | Best solutions | Back to list |
EIGHTS - Triple Fat Ladies |
Pattern Matchers have been designed for various sorts of patterns. Mr. HKP likes to observe patterns in numbers. After completing his extensive research on the squares of numbers, he has moved on to cubes. Now he wants to know all numbers whose cube ends in 888.
Given a number k, help Mr. HKP find the kth number (indexed from 1) whose cube ends in 888.
Input
The first line of the input contains an integer t, the number of test cases. t test cases follow.
Each test case consists of a single line containing a single integer k (1 <= k <= 2000000000000).
Output
For each test case, output a single integer which denotes the kth number whose cube ends in 888. The result will be less than 263.
Example
Input: 1 1 Output: 192
Added by: | Matthew Reeder |
Date: | 2006-10-30 |
Time limit: | 1.197s |
Source limit: | 30000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ERL JS-RHINO NODEJS PERL6 VB.NET |
Resource: | Al-Khawarizm 2006 |
hide comments
|
||||||||||||||
2015-08-02 13:22:57 Anant Upadhyay
nice on hocs........ but question not explained clearly!! |
||||||||||||||
2015-08-02 13:02:08 Anurag Sharma
nice ad-hoc.... |
||||||||||||||
2015-07-30 17:38:35
To solve this problem, do we have to note the first few numbers whose cubes end in 888 or we have an alternate solution? |
||||||||||||||
2015-07-28 11:17:47
my favourite number is 250 |
||||||||||||||
2015-07-26 13:04:03
What does k^th number mean? From what I understand the example formula has to be "(1^192)^3" , or? But that's 1. I see that 192^3 = ...888. But where is k in this formula? Is it suppoesed to be (k*192)^3 ... I don't get it ... -.- Maybe it's because I'm not a native speaker of English, and I oversee something?! If test case "1 4 942" is right, then I got it ... It's not k^th, but kth :) Last edit: 2015-07-26 13:36:45 |
||||||||||||||
2015-07-21 17:48:05
easy |
||||||||||||||
2015-07-02 14:13:15
you can find the solution and logic here. it's an easy pattern. give it a try if not able to resolve then go to <snip> Last edit: 2022-08-07 10:46:34 |
||||||||||||||
2015-06-22 10:33:18 Ankush
O(1) :D |
||||||||||||||
2015-05-28 15:27:31 Mayank
I did this question by generating the series and observing the pattern but is there any logic by number theory? Last edit: 2015-05-28 15:28:43 |
||||||||||||||
2015-05-26 09:48:45 Harsh Vardhan Ladha
Lol the pattern :D |