Created
January 15, 2016 14:48
-
-
Save Jack-Saleem/ab94f1824591411f43cc to your computer and use it in GitHub Desktop.
Codeforces 263A BeautifulMatrix program in java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class BeautifulMatrix | |
{ | |
public static void main(String args[]) | |
{ | |
Scanner z = new Scanner(System.in); | |
int[][] a=new int[6][6]; | |
for(int i=1;i<=5;i++) | |
{ | |
for(int j=1;j<=5;j++) | |
a[i][j]=z.nextInt(); | |
} | |
for(int i=1;i<=5;i++) | |
{ | |
for(int j=1;j<=5;j++) | |
{ | |
if(a[i][j]==1) | |
System.out.println(Math.abs(3-i)+Math.abs(3-j)); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment