CODEFORCES- BEAUTIFUL MATRIX SOLUTION
PROBLEM- https://codeforces.com/problemset/problem/263/A
#include<stdio.h>
#include<stdlib.h>
int main(){
int matrix[5][5];
int i, j, x=0, y=0, move;
for(i=0; i<5; i++){
for(j=0; j<5; j++){
scanf("%d", &matrix[i][j]);
}
}
for(i=0; i<5; i++){
for(j=0; j<5; j++){
if(matrix[i][j]==1){
x=i+1;
y=j+1;
}
}
}
move = abs(x-3)+abs(y-3);
printf("%d\n", move);
return 0;
}