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

Envío 4763

Problema 0x32 - Sumar dos números muy grandes

  • Autor: Ikerlb
  • Fecha: 2021-08-13 06:15:58 UTC (Hace más de 2 años)
Caso # Resultado Tiempo Memoria
#1
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 14, in <module>
    print(add(s, t))
  File "script.py", line 4, in add
    while i >= 0 or j >= 0 or c:
NameError: name 'i' is not defined
0.028 s 3 KBi
#2
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 14, in <module>
    print(add(s, t))
  File "script.py", line 4, in add
    while i >= 0 or j >= 0 or c:
NameError: name 'i' is not defined
0.029 s 3 KBi
#3
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 14, in <module>
    print(add(s, t))
  File "script.py", line 4, in add
    while i >= 0 or j >= 0 or c:
NameError: name 'i' is not defined
0.025 s 3 KBi
#4
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 14, in <module>
    print(add(s, t))
  File "script.py", line 4, in add
    while i >= 0 or j >= 0 or c:
NameError: name 'i' is not defined
0.02 s 3 KBi
#5
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 14, in <module>
    print(add(s, t))
  File "script.py", line 4, in add
    while i >= 0 or j >= 0 or c:
NameError: name 'i' is not defined
0.024 s 4 KBi
#6
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 14, in <module>
    print(add(s, t))
  File "script.py", line 4, in add
    while i >= 0 or j >= 0 or c:
NameError: name 'i' is not defined
0.024 s 3 KBi
#7
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 14, in <module>
    print(add(s, t))
  File "script.py", line 4, in add
    while i >= 0 or j >= 0 or c:
NameError: name 'i' is not defined
0.027 s 3 KBi
#8
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 14, in <module>
    print(add(s, t))
  File "script.py", line 4, in add
    while i >= 0 or j >= 0 or c:
NameError: name 'i' is not defined
0.019 s 3 KBi
#9
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 14, in <module>
    print(add(s, t))
  File "script.py", line 4, in add
    while i >= 0 or j >= 0 or c:
NameError: name 'i' is not defined
0.028 s 3 KBi
#10
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 14, in <module>
    print(add(s, t))
  File "script.py", line 4, in add
    while i >= 0 or j >= 0 or c:
NameError: name 'i' is not defined
0.022 s 3 KBi
#11
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 14, in <module>
    print(add(s, t))
  File "script.py", line 4, in add
    while i >= 0 or j >= 0 or c:
NameError: name 'i' is not defined
0.021 s 3 KBi
#12
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 14, in <module>
    print(add(s, t))
  File "script.py", line 4, in add
    while i >= 0 or j >= 0 or c:
NameError: name 'i' is not defined
0.018 s 3 KBi
#13
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 14, in <module>
    print(add(s, t))
  File "script.py", line 4, in add
    while i >= 0 or j >= 0 or c:
NameError: name 'i' is not defined
0.021 s 3 KBi
#14
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 14, in <module>
    print(add(s, t))
  File "script.py", line 4, in add
    while i >= 0 or j >= 0 or c:
NameError: name 'i' is not defined
0.022 s 3 KBi
#15
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 14, in <module>
    print(add(s, t))
  File "script.py", line 4, in add
    while i >= 0 or j >= 0 or c:
NameError: name 'i' is not defined
0.028 s 3 KBi
#16
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 14, in <module>
    print(add(s, t))
  File "script.py", line 4, in add
    while i >= 0 or j >= 0 or c:
NameError: name 'i' is not defined
0.023 s 3 KBi
#17
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 14, in <module>
    print(add(s, t))
  File "script.py", line 4, in add
    while i >= 0 or j >= 0 or c:
NameError: name 'i' is not defined
0.028 s 3 KBi
#18
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 14, in <module>
    print(add(s, t))
  File "script.py", line 4, in add
    while i >= 0 or j >= 0 or c:
NameError: name 'i' is not defined
0.025 s 3 KBi
#19
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 14, in <module>
    print(add(s, t))
  File "script.py", line 4, in add
    while i >= 0 or j >= 0 or c:
NameError: name 'i' is not defined
0.021 s 3 KBi
#20
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 14, in <module>
    print(add(s, t))
  File "script.py", line 4, in add
    while i >= 0 or j >= 0 or c:
NameError: name 'i' is not defined
0.027 s 3 KBi
#21
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 14, in <module>
    print(add(s, t))
  File "script.py", line 4, in add
    while i >= 0 or j >= 0 or c:
NameError: name 'i' is not defined
0.032 s 3 KBi
#22
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 14, in <module>
    print(add(s, t))
  File "script.py", line 4, in add
    while i >= 0 or j >= 0 or c:
NameError: name 'i' is not defined
0.029 s 3 KBi
#23
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 14, in <module>
    print(add(s, t))
  File "script.py", line 4, in add
    while i >= 0 or j >= 0 or c:
NameError: name 'i' is not defined
0.025 s 3 KBi
#24
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 14, in <module>
    print(add(s, t))
  File "script.py", line 4, in add
    while i >= 0 or j >= 0 or c:
NameError: name 'i' is not defined
0.029 s 3 KBi
#25
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 14, in <module>
    print(add(s, t))
  File "script.py", line 4, in add
    while i >= 0 or j >= 0 or c:
NameError: name 'i' is not defined
0.025 s 3 KBi
#26
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 14, in <module>
    print(add(s, t))
  File "script.py", line 4, in add
    while i >= 0 or j >= 0 or c:
NameError: name 'i' is not defined
0.019 s 3 KBi
#27
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 14, in <module>
    print(add(s, t))
  File "script.py", line 4, in add
    while i >= 0 or j >= 0 or c:
NameError: name 'i' is not defined
0.031 s 3 KBi
#28
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 14, in <module>
    print(add(s, t))
  File "script.py", line 4, in add
    while i >= 0 or j >= 0 or c:
NameError: name 'i' is not defined
0.021 s 3 KBi
#29
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 14, in <module>
    print(add(s, t))
  File "script.py", line 4, in add
    while i >= 0 or j >= 0 or c:
NameError: name 'i' is not defined
0.021 s 3 KBi
#30
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 14, in <module>
    print(add(s, t))
  File "script.py", line 4, in add
    while i >= 0 or j >= 0 or c:
NameError: name 'i' is not defined
0.025 s 3 KBi
#31
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 14, in <module>
    print(add(s, t))
  File "script.py", line 4, in add
    while i >= 0 or j >= 0 or c:
NameError: name 'i' is not defined
0.022 s 3 KBi
#32
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 14, in <module>
    print(add(s, t))
  File "script.py", line 4, in add
    while i >= 0 or j >= 0 or c:
NameError: name 'i' is not defined
0.022 s 3 KBi
#33
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 14, in <module>
    print(add(s, t))
  File "script.py", line 4, in add
    while i >= 0 or j >= 0 or c:
NameError: name 'i' is not defined
0.023 s 3 KBi
#34
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 14, in <module>
    print(add(s, t))
  File "script.py", line 4, in add
    while i >= 0 or j >= 0 or c:
NameError: name 'i' is not defined
0.021 s 3 KBi
#35
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 14, in <module>
    print(add(s, t))
  File "script.py", line 4, in add
    while i >= 0 or j >= 0 or c:
NameError: name 'i' is not defined
0.02 s 3 KBi
#36
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 14, in <module>
    print(add(s, t))
  File "script.py", line 4, in add
    while i >= 0 or j >= 0 or c:
NameError: name 'i' is not defined
0.021 s 3 KBi
#37
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 14, in <module>
    print(add(s, t))
  File "script.py", line 4, in add
    while i >= 0 or j >= 0 or c:
NameError: name 'i' is not defined
0.021 s 3 KBi
#38
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 14, in <module>
    print(add(s, t))
  File "script.py", line 4, in add
    while i >= 0 or j >= 0 or c:
NameError: name 'i' is not defined
0.023 s 3 KBi
Puntos totales: 0 / 100

Código

def add(s, t):
    res = []
    c = 0
    while i >= 0 or j >= 0 or c:
        ds = int(s[i]) if i >= 0 else 0
        dt = int(t[i]) if j >= 0 else 0
        c, nd = divmod(ds + dt + c)
        res.append(str(nd))
    return "".join(reversed(res))

if __name__ == "__main__":
    s = input()
    t = input()
    print(add(s, t))