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);
- short n,m;
- cin>>n>>m;
- short kw[n][m];
- for(short x=0; x<n; x++)
- {
- for(short z=0; z<m; z++)
- {
- cin>>kw[x][z];
- }
- }
- int q;
- short a1,b1,a2,b2;
- int suma=0;
- cin>>q;
- for(int z=0; z<q; z++)
- {
- cin>>a1>>b1>>a2>>b2;
- for(short i = a1 - 1; i < a2; ++i)
- for(short 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