#C6740. Count Positive Numbers in a Matrix

    ID: 50534 Type: Default 1000ms 256MiB

Count Positive Numbers in a Matrix

Count Positive Numbers in a Matrix

You are given a matrix of integers. Your task is to count the number of positive integers in the matrix. A number is considered positive if it is strictly greater than zero.

The input will be provided from standard input. The first line of input contains two integers N and M, which represent the number of rows and columns of the matrix respectively. The next N lines each contain M integers separated by spaces, representing the elements of the matrix.

Your program should output a single integer representing the number of positive numbers found in the matrix.

In mathematical terms, if the matrix is denoted as \(A\) where \(A_{ij}\) is the element in the \(i^{th}\) row and \(j^{th}\) column, you need to compute:

[ \text{count} = \sum_{i=1}^{N} \sum_{j=1}^{M} \mathbb{1}(A_{ij} > 0), ]

where \(\mathbb{1}(\text{condition})\) is 1 if the condition holds, and 0 otherwise.

inputFormat

The first line contains two integers N and M separated by a space, representing the number of rows and columns of the matrix respectively. The next N lines contain M integers each, representing the values in the matrix.

outputFormat

Output a single integer: the count of positive numbers (greater than zero) in the matrix.

## sample
3 3
-1 2 3
4 5 -6
7 -8 9
6