There are n (n <= 100) integers, which have been arranged in ascending order. Now give another integer x, please insert the number into the sequence and keep the new sequence still ordered.
The input data contains multiple test cases. Each set of data consists of two rows, the first row is n and m, and the second row is a sequence of n numbers that have been ordered. n and m are 0 at the same time to mark the end of the input data, this line does not do processing.
For each test case, output the sequence after inserting the new element.
1 | 3 3 |
1 | 1 2 3 4 |
Using C++ Sort.
1 |
|