啊这

箱子归位

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);//绝对值
}
全部评论

相关推荐

07-07 12:25
门头沟学院 Java
程序员牛肉:你这个智邮公司做的就是那个乐山市税务系统的服务吗?
点赞 评论 收藏
分享
评论
10
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务