-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path263A.cpp
More file actions
33 lines (26 loc) · 765 Bytes
/
Copy path263A.cpp
File metadata and controls
33 lines (26 loc) · 765 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include <iostream>
using namespace std;
int main()
{
int arr[5][5];
for(int i = 0; i < 5 ; i++){
for(int j = 0; j < 5; j++){
cin>>arr[i][j];
}
}
int r = 0,c = 0;
for(int i = 0; i < 5 ; i++){
for(int j = 0; j < 5; j++){
if(arr[i][j] == 1){
r = j;
c = i;
break;
}
}
}
if(r == 2 && c == 2) cout<<0;
else if(r == 2) cout<<abs(c - 2);
else if(c == 2) cout<<abs(r - 2);
else cout<<abs(c - 2) + abs(r - 2);
return 0;
}