Created
August 9, 2019 21:19
-
-
Save lazycipher/e7d1ce2c43b109e5800f55b2a6cb2841 to your computer and use it in GitHub Desktop.
263A - Beautiful Matrix Solution in CPP
This file contains 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
#include<iostream> | |
int main(){ | |
int arr[5][5]; | |
int x,y; | |
for(int i=0; i<5; i++){ | |
for(int j=0; j<5; j++){ | |
std::cin>>arr[i][j]; | |
if(arr[i][j]!=0){ | |
x=i+1; | |
y=j+1; | |
} | |
} | |
} | |
std::cout<<abs(x-3)+abs(y-3); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment