blob: 8630ae24595f2f12c61403b52f4ffe9e532fdf05 (
plain)
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
|
#include <iostream>
#include <math.h>
using namespace std;
#define SZ 5
// Remember: never store the matrix
// If you have to, store it as array
int main(void){
int a;
int b,c;
for(int i = 0; i < SZ; i++){
for(int j = 0; j < SZ; j++){
cin>>a;
if(a == 1){
b = i;
c = j;
goto result;
}
}
}
result:
int rows = abs(2 - c);
int columns = abs(2 - b);
cout<<rows+columns<<endl;
return 0;
}
|