我试图解决263A-beautifuly Matrix的问题,但出现了运行时错误
我的代码是:
import numpy as np
matrix = []
for i in range(5):
matrix.append(list(map(int, input().split())))
arr = np.array(matrix)
loc = list(np.argwhere(arr == 1)[0])
x1, y1, x2, y2 = loc[0], loc[1], 2, 2
print(abs(x1-x2)+abs(y1-y2)) # Manhattan distance
感谢您的帮助或指点
运行时错误是由于使用了numpy库造成的。 我不确定,但是你不能在codeforces中使用这种库。 尝试在不使用此库的情况下回答此问题
如果你被卡住了,试着读社论
相关问题 更多 >
编程相关推荐