Endreçar i eliminar repetits


Submit solution

Points: 10
Time limit: 5.0s
Memory limit: 256M

Author:
Problem types
Allowed languages
C#, Go, Java

Escriu un programa que, donada una llista de \(Nt\) nombres enters \(Ni\) que si es podrien repetir, els mostri endreçats ascendentment però eliminant els nombres repetits.

Nota: no es permet l'ús de funcions que endreçin llistes de forma automàtica.

Input Format

Primera línia:

  • \(Nt\): quantitat de nombres que es rebràn.

Segona línia:

  • Els nombres \(Ni\) separats per un espai.

Constraints

  • \(Nt > 0\)
  • \(Ni\) i \(Nt\): són nombres enters.

Output Format

El llistat de nombres endreçat ascendentment, con cada nombre \(Ni\) es separa del següent amb un espai, i on no apareixen nombres repetits.

Sample Input 0

4
8 5 3 3

Sample Output 0

3 5 8

Sample Input 1

10
10 9 8 7 6 5 4 3 2 1

Sample Output 1

1 2 3 4 5 6 7 8 9 10

Sample Input 2

5
3 3 3 3 3

Sample Output 2

3

Sample Input 3

3
0 1 -1

Sample Output 3

-1 0 1

Sample Input 4

5
-1 -2 -3 -4 -5

Sample Output 4

-5 -4 -3 -2 -1

Sample Input 5

1
0

Sample Output 5

0

Autoria: Fernando Porrino Serrano

CC BY-NC-SA 4.0