-
Notifications
You must be signed in to change notification settings - Fork 0
/
Prblm 10
53 lines (49 loc) · 1.14 KB
/
Prblm 10
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
42
43
44
45
46
47
48
49
50
51
52
53
#include <bits/stdc++.h>
using namespace std;
int main()
{
long long int x,y,i,j,k,arr[5][5],sum=0;
for(i=0;i<5;i++)
{
for(j=0;j<5;j++)
{
cin>>arr[i][j];
if(arr[i][j]==1)
{
x=i;
y=j;
if(x<2){
sum=sum+2-x;
if(y<2){
sum=sum+2-y;
}
else if(y>2)
{
sum=sum+y-2;
}
}
else if(x>2){
sum=sum+x-2;
if(y<2){
sum=sum+2-y;
}
else if(y>2)
{
sum=sum+y-2;
}
}
else{
if(y<2){
sum=sum+2-y;
}
else if(y>2)
{
sum=sum+y-2;njdscjn
}
}
}
}
}
cout<<sum;
return 0;
}