AtCoder Regular Contest 146
翻译中…
Problem Statement
翻译中…
There are $N$ cards, numbered $1$ to $N$.
翻译中…
Card $i$ has a positive integer $A_i$ 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 $1$, $23$, and $4$ written on them, you can make integers such as $1234$ and $4231$.
翻译中…
Find the maximum integer you can make.
翻译中…
Constraints
翻译中…
$3 \le N \le 2 \times 10^5$$1 \le A_i < 10^6$- All values in input are integers.
翻译中…
Input
翻译中…
Input is given from Standard Input in the following format:
翻译中…
N
A_1 A_2 \dots A_N
翻译中…
Output
翻译中…
Print the answer.
翻译中…
样例
Input #1
5
1 4 3 5 8
Output #1
854
If you choose cards with $4$, $5$, and $8$ written on them, you can make $458$, $485$, $548$, $584$, $845$, or $854$.
You can make nothing greater than $854$, so the answer is $854$.
Input #2
8
813 921 481 282 120 900 555 409
Output #2
921900813
题目信息
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。