Superdromes
Practice
1 (1 votes)
Open
Approved
Open
Approved
Open
Basic programming
Easy
Implementation
Basics of implementation
Problem
4% Success 70 Attempts 30 Points 1s Time Limit 256MB Memory 1024 KB Max Code

You have recently read about superdromes. Superdromes are those numbers that are palindromic in both binary and decimal representation.

The number represented in binary representation is up to its most significant bit that is \(1\). For example, \(2\) will be represented as \(\{10\}\), \(6\) is represented as \(\{110\}\), and so on.

Your task is to determine the number of superdromes that are less than or equal to \(n\) for provided \(n\).

Input format

  • First line: A single integer \(q\) denoting the number of queries
  • Next line: \(q\) space-separated integer where the \(i_{th}\) integer is \(n\) for the \(i_{th}\) query

Output format
Print a single integer that represents the number of superdromes that is less than or equal to \(n\) for each query. Print the answer for each query as space-separated integers.

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:30
36 votes
Tags:
AlgorithmsApprovedImplementationMathMediumOpen
Points:20
1 votes
Tags:
Easy
Points:30
8 votes
Tags:
MathematicsMedium