-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path263A.cpp
41 lines (33 loc) · 851 Bytes
/
263A.cpp
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
34
35
36
37
38
39
40
41
#include<bits/stdc++.h>
using namespace std;
int main(){
int n[5][5],m[1][1],inrow,incol,cnt=0;
for(int i=0;i<5;i++){
for(int j=0;j<5;j++){
cin>>n[i][j];
if(n[i][j]==1){
inrow=i;
incol=j;
}
}
}
for(int j=0;j<25;j++){
if(incol>2){
incol--;
cnt++;
}else if(incol<2){
incol++;
cnt++;
}else if(incol == 2 && inrow>2){
inrow--;
cnt++;
}else if(incol == 2 && inrow<2){
inrow++;
cnt++;
}else if(incol == 2 && inrow == 2){
cout<<cnt<<"\n";
return 0;
}
}
return 0;
}