Codeforces Round #161 (Div. 2) A. Beautiful Matrix

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

#include <iostream>
#include <cmath>
using namespace std;

int main()

{
    int t;
    int row,col;
    for(int i=0;i<5;i++)
    {
        for(int j=0;j<5;j++)
        {
            cin >>t;
            if(t==1) 
            {
                row=i+1;
                col=j+1;
            }
        }
    }
    int ans=abs(row-3)+abs(col-3);
    cout << ans;
    return 0;
}

 

posted @ 2013-01-17 02:15  Daniel Qiu  阅读(118)  评论(0)    收藏  举报