Sunday, October 25, 2020

CODEFORCES- BEAUTIFUL MATRIX SOLUTION (24-10)

 CODEFORCES- BEAUTIFUL MATRIX SOLUTION

PROBLEM-  https://codeforces.com/problemset/problem/263/A

#include<stdio.h>
#include<stdlib.h>
int main(){
    int matrix[5][5];
    int i, j, x=0, y=0, move;
    for(i=0; i<5; i++){
        for(j=0; j<5; j++){
            scanf("%d", &matrix[i][j]);
        }
    }
    for(i=0; i<5; i++){
        for(j=0; j<5; j++){
            if(matrix[i][j]==1){
                x=i+1;
                y=j+1;
            }
        }
    }
    move = abs(x-3)+abs(y-3);
    printf("%d\n", move);
    return 0;
}

No comments:

Post a Comment

LEETCODE JUNE 2021 DAILY CODING CHALLENGE

 LEETCODE JUNE 2021 DAILY CODING CHALLENGE JUNE 1 JUNE 2 JUNE 3 JUNE 4 JUNE 5 Maximum Performance of a Team LINK You are given two integers ...