mirror of
https://github.com/xlucn/PAT.git
synced 2026-10-30 00:37:37 +08:00
21 lines
1.0 KiB
HTML
21 lines
1.0 KiB
HTML
<!DOCTYPE html>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
|
<h1>1038. Recover the Smallest Number (30)</h1>
|
|
<div id="problemContent">
|
|
<p>Given a collection of number segments, you are supposed to recover the smallest number from them. For example, given {32, 321, 3214, 0229, 87}, we can recover many numbers such like 32-321-3214-0229-87 or 0229-32-87-321-3214 with respect to different orders of combinations of these segments, and the smallest number is 0229-321-3214-32-87.</p>
|
|
<p><b>
|
|
Input Specification:
|
|
</b></p>
|
|
<p>Each input file contains one test case. Each case gives a positive integer N (<=10000) followed by N number segments. Each segment contains a non-negative integer of no more than 8 digits. All the numbers in a line are separated by a space.</p>
|
|
<p><b>
|
|
Output Specification:
|
|
</b></p>
|
|
<p>For each test case, print the smallest number in one line. Do not output leading zeros.
|
|
</p>
|
|
<b>Sample Input:</b><pre>
|
|
5 32 321 3214 0229 87
|
|
</pre>
|
|
<b>Sample Output:</b><pre>
|
|
22932132143287
|
|
</pre>
|
|
</div> |