Created
February 24, 2017 06:15
-
-
Save hikilaka/47e5c5de34bf7bab719d7305d2417348 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int matrixElementsSum(std::vector<std::vector<int>> matrix) { | |
int price = 0; | |
for (int row = 0; row < matrix[0].size(); ++row) { | |
for (int col = 0; col < matrix.size(); ++col) { | |
if (matrix[col][row] == 0) { | |
break; | |
} else { | |
price += matrix[col][row]; | |
} | |
} | |
} | |
return price; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment