/* Use the quick line to implement the title description: Enter a series of integers, pick out the largest number, and sort the remaining numbers. Input: Enter the first line including 1 integer n,1<=n<=1000, which represents the number of input data. The next line has n integers. Output: There may be multiple sets of test data, for each set of data, the first line outputs an integer representing the maximum value in n integers, and the value is removed from the array, and the remaining number is sorted. The second row will sort the result output. Sample input: 41 3 4 2 sample output: 41 2 3 Tip: If there is only one number in the array, when the first row has its output, the second line outputs "-1". */# include <stdio.h>void QuickSort (int * A, int low, int.) {int left,right,pivot;pivot = A[low];left = Low;right = High;while (Low < High) {when (Low < high && A[high] >= pivot) High--;a[low] = A[high];while (Low < HIG H && A[low] <= pivot) Low++;a[high] = A[low];} A[low] = Pivot;if (left! = Low) QuickSort (A, left, low-1); "Right! = High" QuickSort (A, low+1, right);} int main (void) {int n;while (scanf ("%d", &n)! = EOF) {GetChar (); Absorbs the carriage return character. int i,a[1010];for (i = 0; i < n; i++) {scanf ("%d", &a[i]);} if (n = = 1) {printf (" -1\n"); continue;} Else{quicksort (A, 0, n-1);p rintf ("%d\n", a[n-1]), for (i = 0; i < n-1; i++) {printf ("%d", A[i]);} printf ("\ n");}} return 0;}
1185 Special Sort