After becoming famous, the CodeBots decided to move into a new building together. Each of the rooms has a different cost, and some of them are free, but there's a rumour that all the free rooms are haunted! Since the CodeBots are quite superstitious, they refuse to stay in any of the free rooms, or any of the rooms below any of the free rooms.
Given matrix, a rectangular matrix of integers, where each value represents the cost of the room, your task is to return the total sum of all rooms that are suitable for the CodeBots (ie: add up all the values that don't appear below a 0).
範例
Input/Output
[execution time limit] 4 seconds (js)
[input] array.array.integer matrixA 2-dimensional array of integers representing the cost of each room in the building. A value of 0 indicates that the room is haunted.Guaranteed constraints:1 ≤ matrix.length ≤ 5,
1 ≤ matrix[i].length ≤ 5,
0 ≤ matrix[i][j] ≤ 10.
[output] integerThe total price of all the rooms that are suitable for the CodeBots to live in.