█████████ ████ ███░░░░░███ ░░███ ███ ░░░ ██████ ███████ ██████ ██████ ░███ ███░░███ ███░░███ ███░░███ ███░░███ ░███ ░███ ░███░███ ░███ ░███████ ░███ ░███ ░░███ ███░███ ░███░███ ░███ ░███░░░ ░███ ░███ ░░█████████ ░░██████ ░░████████░░██████ ░░██████ ░░░░░░░░░ ░░░░░░ ░░░░░░░░ ░░░░░░ ░░░░░░

Envío 2021

Problema 0x5c - Decir si hay una letra repetida

  • Autor: abatesins
  • Fecha: 2020-11-17 14:35:41 UTC (Hace alrededor de 4 años)
Caso # Resultado Tiempo Memoria
#1
Error de compilación
                      main.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
word = input()
^
main.c:1:8: warning: implicit declaration of function 'input' is invalid in C99 [-Wimplicit-function-declaration]
word = input()
       ^
main.c:1:8: error: initializer element is not a compile-time constant
word = input()
       ^~~~~~~
main.c:1:15: error: expected ';' after top level declarator
word = input()
              ^
              ;
2 warnings and 2 errors generated.

                    
#2
Error de compilación
                      main.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
word = input()
^
main.c:1:8: warning: implicit declaration of function 'input' is invalid in C99 [-Wimplicit-function-declaration]
word = input()
       ^
main.c:1:8: error: initializer element is not a compile-time constant
word = input()
       ^~~~~~~
main.c:1:15: error: expected ';' after top level declarator
word = input()
              ^
              ;
2 warnings and 2 errors generated.

                    
#3
Error de compilación
                      main.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
word = input()
^
main.c:1:8: warning: implicit declaration of function 'input' is invalid in C99 [-Wimplicit-function-declaration]
word = input()
       ^
main.c:1:8: error: initializer element is not a compile-time constant
word = input()
       ^~~~~~~
main.c:1:15: error: expected ';' after top level declarator
word = input()
              ^
              ;
2 warnings and 2 errors generated.

                    
#4
Error de compilación
                      main.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
word = input()
^
main.c:1:8: warning: implicit declaration of function 'input' is invalid in C99 [-Wimplicit-function-declaration]
word = input()
       ^
main.c:1:8: error: initializer element is not a compile-time constant
word = input()
       ^~~~~~~
main.c:1:15: error: expected ';' after top level declarator
word = input()
              ^
              ;
2 warnings and 2 errors generated.

                    
#5
Error de compilación
                      main.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
word = input()
^
main.c:1:8: warning: implicit declaration of function 'input' is invalid in C99 [-Wimplicit-function-declaration]
word = input()
       ^
main.c:1:8: error: initializer element is not a compile-time constant
word = input()
       ^~~~~~~
main.c:1:15: error: expected ';' after top level declarator
word = input()
              ^
              ;
2 warnings and 2 errors generated.

                    
#6
Error de compilación
                      main.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
word = input()
^
main.c:1:8: warning: implicit declaration of function 'input' is invalid in C99 [-Wimplicit-function-declaration]
word = input()
       ^
main.c:1:8: error: initializer element is not a compile-time constant
word = input()
       ^~~~~~~
main.c:1:15: error: expected ';' after top level declarator
word = input()
              ^
              ;
2 warnings and 2 errors generated.

                    
#7
Error de compilación
                      main.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
word = input()
^
main.c:1:8: warning: implicit declaration of function 'input' is invalid in C99 [-Wimplicit-function-declaration]
word = input()
       ^
main.c:1:8: error: initializer element is not a compile-time constant
word = input()
       ^~~~~~~
main.c:1:15: error: expected ';' after top level declarator
word = input()
              ^
              ;
2 warnings and 2 errors generated.

                    
#8
Error de compilación
                      main.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
word = input()
^
main.c:1:8: warning: implicit declaration of function 'input' is invalid in C99 [-Wimplicit-function-declaration]
word = input()
       ^
main.c:1:8: error: initializer element is not a compile-time constant
word = input()
       ^~~~~~~
main.c:1:15: error: expected ';' after top level declarator
word = input()
              ^
              ;
2 warnings and 2 errors generated.

                    
#9
Error de compilación
                      main.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
word = input()
^
main.c:1:8: warning: implicit declaration of function 'input' is invalid in C99 [-Wimplicit-function-declaration]
word = input()
       ^
main.c:1:8: error: initializer element is not a compile-time constant
word = input()
       ^~~~~~~
main.c:1:15: error: expected ';' after top level declarator
word = input()
              ^
              ;
2 warnings and 2 errors generated.

                    
#10
Error de compilación
                      main.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
word = input()
^
main.c:1:8: warning: implicit declaration of function 'input' is invalid in C99 [-Wimplicit-function-declaration]
word = input()
       ^
main.c:1:8: error: initializer element is not a compile-time constant
word = input()
       ^~~~~~~
main.c:1:15: error: expected ';' after top level declarator
word = input()
              ^
              ;
2 warnings and 2 errors generated.

                    
#11
Error de compilación
                      main.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
word = input()
^
main.c:1:8: warning: implicit declaration of function 'input' is invalid in C99 [-Wimplicit-function-declaration]
word = input()
       ^
main.c:1:8: error: initializer element is not a compile-time constant
word = input()
       ^~~~~~~
main.c:1:15: error: expected ';' after top level declarator
word = input()
              ^
              ;
2 warnings and 2 errors generated.

                    
#12
Error de compilación
                      main.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
word = input()
^
main.c:1:8: warning: implicit declaration of function 'input' is invalid in C99 [-Wimplicit-function-declaration]
word = input()
       ^
main.c:1:8: error: initializer element is not a compile-time constant
word = input()
       ^~~~~~~
main.c:1:15: error: expected ';' after top level declarator
word = input()
              ^
              ;
2 warnings and 2 errors generated.

                    
Puntos totales: 0 / 100

Código

word = input()

HT_LEN = 26  # minimal perfect hashing with ord()
ht = [False] * HT_LEN
repeated = 'yes'
for char in word:
  idx = ord(char) - 97  # ord('a') == 97
  if ht[idx]:
    break
  else:
    ht[idx] = True
else:
  repeated = 'no'
print(repeated)