The problem description enters a sequence of 10 integers that requires ascending sorting and removes duplicate elements. Enter a format of 10 integers. Output format multiple lines of output, one element per line. Sample input 2233115555 Sample Output 1235
Problem Solving Ideas:
If the input number exists in the array, it is excluded, otherwise the storage
Sort from small to large, and output
AC Code:
1#include <stdio.h>2 #defineMAX 103 4 intMainvoid)5 {6 inti =0, j =0, k =0;7 intarr[max+1];8 for(k =0; K < MAX; K + +)9 {Tenscanf"%d", &arr[i++]); One for(j = i2; J >=0; J--) A { - if(Arr[j] = = arr[i-1]) - { theI--; - Break; - } - } + } - + /*Sort*/ A for(j =0; J < I; J + +) at { - for(k = j+1; K < I; K + +) - { - if(Arr[k] <Arr[j]) - { -ARR[J] = Arr[j] ^Arr[k]; inARR[K] = Arr[j] ^Arr[k]; -ARR[J] = Arr[j] ^Arr[k]; to } + } -printf"%d\n", Arr[j]); the } * return 0; $}
Algo-39_ Blue Bridge Cup _ Algorithm Training _ array sorting de-weight