Primero igual al último


Submit solution

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

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

Se deben ir leyendo números hasta que se lea un 0. El programa debe mostrar SI en caso de que el primer número leído sea igual al último número leído antes que el 0. En caso contrario debe mostrar NO.

Input Format

Un secuencia de N números enteros que finaliza con un 0.

Constraints

1 <= N <= 10^7

Output Format

SI o NO

Sample Input 0

1 2 3 2 1 0

Sample Output 0

SI

Sample Input 1

1 0

Sample Output 1

SI

Sample Input 2

1 2 0

Sample Output 2

NO

Sample Input 3

1 2 1 2 1 2 1 0

Sample Output 3

SI

Sample Input 4

-1 1 -1 1 -1 0

Sample Output 4

SI

Sample Input 5

4 7 12 15 26 46 3 2 1 4 0

Sample Output 5

SI

Sample Input 6

1 2 3 4 0

Sample Output 6

NO

Autoria: Rusben

CC BY-NC-SA 4.0