A relay station receives exactly three transmitter codes for the next broadcast cycle. Each code is a positive integer, and the station encodes it as a binary signature — its binary representation with no leading zeros. To build the outgoing broadcast key, the station splices the three binary signatures end to end, in an order of its choosing, and reads the resulting bit string as a single binary number.
Given the three transmitter codes, determine the order that produces the largest possible broadcast number, and report that number in decimal.
A single line containing three integers a b c, the three transmitter codes.
A single integer: the maximum decimal value obtainable by concatenating the binary representations of a, b, and c (in any order, each without leading zeros).
Example 1
Input
1 2 3
Expected
30
Explanation
The binary signatures are 1, 10, and 11. Ordering the codes as 1, 3, 2 splices the signatures into "1"+"11"+"10" = "11110", which equals 30 in decimal — the largest value among all six orderings (the reverse ordering 3, 1, 2 also reaches 30, but no ordering beats it).
Example 2
Input
127 4 8
Expected
16328
Explanation
The binary signatures are 1111111, 100, and 1000. Placing 127 first, then 4, then 8, splices them into "1111111"+"100"+"1000" = "11111111001000", which equals 16328 in decimal — the largest value achievable among all six orderings, since leading with the longest signature (127) always dominates the higher-order bits.
Ready to solve this?
Sign in to open the editor, run your code against the sample tests, and submit against the full test suite.
Sign in to solve →