atcoder#ARC146A. [ARC146A] Three Cards
[ARC146A] Three Cards
Score : points
Problem Statement
There are cards, numbered to .
Card has a positive integer written on it.
You can choose three of these cards and concatenate the integers written on them in any order you like to make a new integer. For example, if you choose cards with , , and written on them, you can make integers such as and .
Find the maximum integer you can make.
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
5
1 4 3 5 8
854
If you choose cards with , , and written on them, you can make , , , , , or .
You can make nothing greater than , so the answer is .
8
813 921 481 282 120 900 555 409
921900813