Strange element (Easy-Version)
Strange element (Easy-Version) easy Time Limit: 2 sec Memory Limit: 128000 kB
Last updated
Strange element (Easy-Version) easy Time Limit: 2 sec Memory Limit: 128000 kB
Last updated
Problem Statement :
An element of the matrix is called strange if its corresponding row and column contains all 1's. Given a boolean matrix of size N*M, your task is to find the number of strange elements. Input The first line of input contains two space-separated integers N and M. Next N lines of input contain M space-separated integers depicting the values of the matrix.
Constraints:- 3 ≤ N, M ≤ 50 0 ≤ Matrix[][] ≤ 1 Output Print the number of strange elements Example Sample Input:- 3 2 1 1 0 1 1 1
Sample Output:- 2
Sample Input:- 4 4 1 0 1 1 0 1 1 1 1 1 1 1 0 1 1 1
Sample Output:- 2
Explanation 1:- (0, 1) and (2, 1)
link: