Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main() {
- int n, m;
- cin >> n >> m;
- int mat[n][m];
- for(int i = 0; i < n; i++) {
- for(int j = 0; j < m; j++) {
- cin >> mat[i][j];
- }
- }
- for(int z = 2; z <= n; z++) {
- if(z - 1 < n and z - 1 < m) {
- int zbir = 0;
- for(int i = z - 1; i >= 0; i--) {
- zbir += mat[i][0];
- zbir += mat[i][z - 1];
- }
- int j = 1;
- for(int i = 1; i < z - 1; i++) {
- zbir += mat[i][j];
- j++;
- }
- cout << zbir << endl;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement