Skip to content

Instantly share code, notes, and snippets.

@Jack-Saleem
Created January 15, 2016 14:48
Show Gist options
  • Save Jack-Saleem/ab94f1824591411f43cc to your computer and use it in GitHub Desktop.
Save Jack-Saleem/ab94f1824591411f43cc to your computer and use it in GitHub Desktop.
Codeforces 263A BeautifulMatrix program in java
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