| # | Problem | Pass Rate (passed user / total user) |
|---|---|---|
| 12089 | DS_2018Fall_Quiz5 |
|
Description
Given at least two positive integers, your task is to arrange them to form the largest number.
There is no integer with leading 0, such as 0123.
Please note that: Digits in each integer cannot be separated.
For example, if we want to arrange 21, 9, and 493. Although we can arrange them to be 219493, 219413 is not the answer because we can also arrange them to form 949321, which forms the largest number. Please note that 994321 is an invalid solution because the digits in 493 are separated and reordered
Input
The input starts with a number n (2<n<10,000), indicating that there are n positive integers, followed by a sequence containing n integers (each integer fits in an int variable in C/C++).
There might be multiple sets of inputs.
The input terminates with an EOF.
Output
For each set of input, please output the largest number according to the rules above.
You need to output '\n' at the end of the line.
(newline)
The result can be very large, even usigned long long cannot store it.
However, usigned long long int can pass half of the test cases. (hint: string)