Seven-Segment Display
Practice
4.1 (342 votes)
Ad Hoc
Basic programming
Easy
Input/output
Problem
49% Success 94499 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code

You all must have seen a seven segment display.If not here it is:

Alice got a number written in seven segment format where each segment was creatted used a matchstick.

Example: If Alice gets a number 123 so basically Alice used 12 matchsticks for this number.

Alice is wondering what is the numerically largest value that she can generate by using at most the matchsticks that she currently possess.Help Alice out by telling her that number.

 

Input Format:

First line contains T (test cases).

Next T lines contain a Number N.

Output Format:

Print the largest possible number numerically that can be generated using at max that many number of matchsticks which was used to generate N.

Constraints:

\(1 \le T \le 100\)

\(1 \le length(N) \le 100\)

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
18 votes
Tags:
AlgorithmsApprovedBreadth First SearchGraphsMediumOpen
Points:50
7 votes
Tags:
ApprovedData StructuresHardImplementationOpenSqrt-DecompositionTreesTries
Points:30
9 votes
Tags:
Ad-HocAlgorithmsApprovedMediumOpen