Lucky String
Practice
4 (4 votes)
Mathematics
Medium
Open
Approved
Mathamatics
Problem
37% Success 1550 Attempts 30 Points 1s Time Limit 256MB Memory 1024 KB Max Code

Lucky numbers are those numbers which contain only "4" and/or "5". For example 4, 5, 44, 54,55,444 are lucky numbers while 457, 987 ,154 are not.

Lucky number sequence is one in which all lucky numbers exist in increasing order for example 4,5,44,45,54,55,444,445,454,455...

Now we concatenate all the lucky numbers (in ascending order) to make a lucky string "4544455455444445454455..."

Given n, your task is to find the nth digit of the lucky string. If the digit is 4 then you have to print "Hacker" else you have to print "Earth".

Input:
first line contain number of test cases T , next T line contain a single interger n.

Output:
For each test case print "Hacker"(without quotes) if nth digit of lucky string is "4" else print "Earth"(without quotes) if nth digit of lucky string is "5".

Constraints:
1<=t<=10^5
1<=n<=10^15

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:30
10 votes
Tags:
MathPrefixBasic MathBasic ProgrammingDynamic Programming
Points:30
46 votes
Tags:
GeometryImplementationOpenAlgorithmsApprovedMedium
Points:30
2 votes
Tags:
MathsPrimesMedium
Editorial

No editorial available for this problem.