|
Download benchmarks/Algorithms/concatenating_numbers/problem.md from PV-SJTU/PV-Bench: direct link, hf CLI and curl.
- Browser
- Download file 832 Bytes
-
https://huggingface.co/datasets/PV-SJTU/PV-Bench/resolve/main/benchmarks/Algorithms/concatenating_numbers/problem.md
- Command line
-
hf download hf://datasets/PV-SJTU/PV-Bench/benchmarks/Algorithms/concatenating_numbers/problem.md
-
curl -L -o problem.md https://huggingface.co/datasets/PV-SJTU/PV-Bench/resolve/main/benchmarks/Algorithms/concatenating_numbers/problem.md
832 Bytes
P1012 Concatenating Numbers
Abstract model
Treat every positive integer as a decimal string. Find a permutation whose concatenation is lexicographically, and therefore numerically, greatest. Ordering strings $x$ and $y$ by whether $xy>yx$ yields an optimal arrangement. This case verifies the comparison-sort implementation.
Problem statement
Given $n$ positive integers, arrange all of them in one row and concatenate adjacent decimal representations. Output the largest integer that can be formed.
Input and output
The first line contains $n$. The second line contains $n$ positive integers. Output their maximum possible concatenation without separators.
Constraints
- $1 \le n \le 20$.
- $1 \le a_i \le 10^9$.