-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmat.java
More file actions
27 lines (22 loc) · 710 Bytes
/
mat.java
File metadata and controls
27 lines (22 loc) · 710 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
import java.util.*;
public class mat {
public static void main(String args[]){
Scanner sc=new Scanner(System.in);
int[][] arr=new int[5][5];
int row=0, col=0;
int stp=0;
for(int i=0;i<arr.length;i++){
for(int j=0;j<arr.length;j++){
arr[i][j]=sc.nextInt();
if(arr[i][j]==1){
row=i;
col= j;
// System.out.println("row" +row);
// System.out.println("row"+col);
}
}
} stp=Math.abs(row-2 )+Math.abs(col-2);
System.out.println(stp);
sc.close();
}
}