Endreçar i filtrar


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ò filtrant un nombre \(Nf\) perquè no aparegui.

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.

Ultima línia:

  • El nombre \(Nf\) que cal filtrar.

Constraints

  • \(Nt > 0\)
  • \(Ni\), \(Nf\) 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 apareix el nombre \(Nf\).

Sample Input 0

10
10 9 8 7 6 5 4 3 2 1
5

Sample Output 0

1 2 3 4 6 7 8 9 10

Sample Input 1

10
10 9 8 7 6 5 4 3 2 1
21

Sample Output 1

1 2 3 4 5 6 7 8 9 10

Sample Input 2

5
9 3 1 8 8
8

Sample Output 2

1 3 9

Sample Input 3

5
9 3 1 8 8
9

Sample Output 3

1 3 8 8

Sample Input 4

5
9 -3 0 8 97
9

Sample Output 4

-3 0 8 97

Sample Input 5

1
0
0

Sample Output 5

  • Atenció: en aquest últim cas, no es mostra res per pantalla.

Autoria: Fernando Porrino Serrano

CC BY-NC-SA 4.0