题目:
代码:
w, m, n = map(int,input().split())
y = max(m,n)//w + 1
matrix = []
res = []
for i in range(y):
temp = [j for j in range(w*i+1, w*(i+1)+1)]
if i%2 == 0:
matrix.append(temp)
else:
temp = temp[::-1]
matrix.append(temp)
if m in temp:
res.append([temp.index(m),i])
if n in temp:
res.append([temp.index(n),i])
print(abs(res[0][1]-res[1][1]) + abs(res[0][0]-res[1][0]))