Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- const int MAX = 11;
- int tab[MAX][MAX], n, m, x, y, t;
- int main()
- {
- ios_base::sync_with_stdio(0);
- cin >> n >> m;
- for (int i = 0; i < n; i++)
- {
- for (int j = 0; j < m; j++) cin >> tab[i][j];
- }
- cin >> t;
- for (int z = 0; z < t; z++)
- {
- cin >> x >> y;
- int sum = 0;
- for (int i = 0; i <= x; i++)
- {
- for (int j = 0; j <= y; j++) sum += tab[i][j];
- }
- cout << sum << " ";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement