啊这
箱子归位
https://ac.nowcoder.com/acm/problem/22212
#include <iostream> #include <math.h> using namespace std; int main() { int a[5][5]; int x, y; int j, i; for (i = 0; i < 5; i++) { for (j = 0; j < 5; j++) { cin >> a[j][i]; if(a[j][i] == 1) { x = j;//知道1的坐标 y = i; } } } cout << abs(x - 2) + abs(y - 2);//绝对值 }