#include<stdio.h>
#include<math.h>
int main()
{
    int h,l,a[25][25],i,j;
    for(i=1;i<=5;i++)
        for(j=1;j<=5;j++)
        {
            scanf("%d",&a[i][j]);
            if(a[i][j]==1)h=i,l=j;
        }
    printf("%d",abs(3-h)+abs(3-l));
    return 0;
}

http://codeforces.com/contest/263/problem/A

posted on 2013-01-18 23:20  海暗  阅读(150)  评论(0编辑  收藏  举报