263A A Beautiful Matrix

#include<iostream>
using namespace std;
int main(){
int arr[5][5];
int j,i=0;
int loc;
for(i=0;i< 5;i++){
 for(j=0;j<5;j++)
cin>>arr[i][j];}

for(i=0;i< 5;i++){
 for(j=0;j<5;j++)
 if(arr[i][j]==1) cout<<abs(2-i)+abs(2-j);
 }
}

Comments

Popular posts from this blog

Codeforce Problem 1703A. YES or YES?

Aptitude test assistant programmer 2018

1041A. Heist solution