Beautifull Matrix Code Forces Solution

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main(){
  5. int n,i,j,s=0,s1=0,l,m;
  6. for(i=1;i<=5;i++){
  7. for(j=1;j<=5;j++){
  8. cin>>n;
  9. if(n==1){
  10. l=i;
  11. m=j;
  12. }
  13. }
  14. }
  15. s=abs(3-l);
  16. s1=abs(3-m);
  17. cout<<s+s1;
  18. }

 ๐Ÿ˜€๐Ÿ˜€๐Ÿ˜€๐Ÿ˜€

If you have any doutbts comment in the below๐Ÿ‘‡

Comment:







Comments

Popular posts from this blog

Factorials problem spoj Solution

Adding Reversed Numbers Spoj Solutions