Pablo and The Secret Code
Practice
2.5 (2 votes)
Sorting
Strings
Easy Medium
Problem
65% Success 1166 Attempts 30 Points 1s Time Limit 256MB Memory 1024 KB Max Code

Pablo is trying to escape from the police master plan which Agent Murphy is trying to execute. While observing some things, he found that the police has a secret code for this plan. Pablo needs to obtain that code!

enter image description here

Pablo got an array of numbers A of length N

There can be many permutations (P1,P2....Pm) of that array.

For each permutation Pi, its code (an integer) is generated by concatenation of all the non-prime numbers in that permutation. Now, there will be many codes, as one code is generated for each permutation. But among those, there exists a secret code.

After some studying on the pattern, Gustavo finds out that the secret code is actually the largest one among all the codes!

Note :- There can be multiple occurrences of the secret code.

Can you help Pablo find the secret code?

INPUT

  • First line contains an integer T, the number of Test Cases.
  • Each test case consists of two lines.
  • The first line of each test case contains N, the number of integers in the array A. The second line of each test case contains space separated integers A1,A2..AN.

OUTPUT

  • Output should contain exactly T lines. Each line containing the secret code for that array. If no number inside the array is non-prime, print No Secret Code!

CONSTRAINTS

  • 1 ≤ T ≤ 10
  • 1 ≤ N ≤ 103
  • 0 ≤ Ai ≤ 105

DISTRIBUTION

  • 1 ≤ T ≤ 10 follows for each file.
  • 1 ≤ N ≤ 5
    0 ≤ Ai ≤ 100 - 10 Points
  • 1 ≤ N ≤ 100
    0 ≤ Ai ≤ 103 - 50 Points
  • 1 ≤ N ≤ 103
    0 ≤ Ai ≤ 105 - 100 Points

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
3 votes
Tags:
AlgorithmsEasy-MediumSorting
Points:30
4 votes
Tags:
Ad-HocRecursionSortingEasy-Medium
Points:30
13 votes
Tags:
SortingAlgorithmsAdvanced SortingGreedy Algorithms