Killjee and superdromes (Lowe)
Practice
3.5 (25 votes)
Approved
Easy
Problem
55% Success 9452 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code

Killjee has recently read about superdromes. Superdromes are those numbers which are palindromic in both binary and decimal representation.

The number represented in binary representation will be up to its most significant bit which is 1.

For example, 2 will be represented as {10}, 6 will be represented as {110} and so on.

Now killjee ask you to find number of Superdromes less than or equal to n for given n.

INPUT FORMAT

First line of input contains a single integer q, denoting number of queries.
Next line contains q space separated integer, \(i_{th}\) integer is n for \(i_{th}\) query.

OUTPUT FORMAT

Output a single integer, number of Superdromes \(\le n\) for each query. Print answer for each query in new line.

INPUT CONSTRAINTS

  • \(1 \le q \le 10^5\)
  • \(1 \le n \le 10^6\)

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:20
8 votes
Tags:
Basic ProgrammingBasics of ImplementationEasyImplementation
Points:20
26 votes
Tags:
AlgorithmsEasy
Points:20
495 votes
Tags:
ApprovedData StructuresEasyImplementation