Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- //ios_base::sync_with_stdio(0);
- int n,m;
- cin>>n>>m;
- int kw[n][m];
- for(int x=0; x<n; x++)
- {
- for(int z=0; z<m; z++)
- {
- cin>>kw[x][z];
- }
- }
- int q,a1,b1,a2,b2,suma=0;
- cin>>q;
- for(int z=0; z<q; z++)
- {
- cin>>a1>>b1>>a2>>b2;
- for(int i = a1 - 1; i < a2; ++i)
- for(int j = b1 - 1; j < b2; ++j)
- suma += kw[i][j];
- cout<<suma<<'\n';
- suma=0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement