我正在 HackerEarth 上解决一个问题,如下:
为您提供一个大小为 N 的数组 A,其中包含非负整数。你的任务是确定所有 N 个数字中最后一位数字所组成的数字是否能被 10 整除。如果可以则打印“Yes”,如果不能则打印“No”。
这就是我所做的:
size = int(input())
integers = input()
integers = [i for i in integers.split(' ')]
last_digit = [i[-1] for i in integers]
number = int(''.join(last_digit))
if number % 10 == 0:
print("Yes")
else:
print("No")
代码对我来说似乎是正确的,但问题是在线 HackerEarth 平台会抛出运行时错误 NZEC,对此我一无所知。所以,我想知道为什么(以及什么样的)错误发生在这里,以及我的代码有什么问题。
https://help.hackerearth.com/hc/en-us/articles/360002673433-types-of-errors
Hackerearth 说
对于像 Python 这样的解释语言,NZEC 通常意味着
通常意味着您的程序崩溃或引发了未捕获的异常
许多运行时错误
使用法官未使用的外部库