# Algo-39_ Blue Bridge Cup _ Algorithm Training _ array sorting de-weight

Source: Internet
Author: User

`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

Related Keywords:

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

## A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

• #### Sales Support

1 on 1 presale consultation

• #### After-Sales Support

24/7 Technical Support 6 Free Tickets per Quarter Faster Response

• Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.