Advertisement
LEGEND2004

e-olymp 9562

Jun 22nd, 2023
1,025
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.55 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.     int n , m;
  7.     cin >> n >> m;
  8.     int a[105][105];
  9.     for(int i = 1; i <= n; i++){
  10.         for(int j = 1; j <= m; j++){
  11.             cin >> a[i][j];
  12.         }
  13.     }
  14.  
  15.     int start_row , start_column , end_row , end_column;
  16.     cin >> start_row >> start_column >> end_row >> end_column;
  17.     int sum = 0;
  18.     for(int i = start_row; i <= end_row; i++){
  19.         for(int j = start_column; j <= end_column; j++){
  20.             sum += a[i][j];
  21.         }
  22.     }
  23.     cout << sum << endl;
  24. }
  25.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement