Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <ctype.h>
- #include <string.h>
- int main() {
- int n, m;
- scanf("%d%d", &n, &m);
- int matrica[n][m];
- for(int i = 0; i < n; i++) {
- for(int j = 0; j < m; j++) {
- scanf("%d", &matrica[i][j]);
- }
- }
- int x, y;
- scanf("%d%d", &x, &y);
- int prv = 0, vtor = 0, tret = 0,cetvrt = 0;
- for(int i = 0; i < n; i++) {
- for(int j = 0; j < m; j++) {
- if(i < x && j >= y) {
- prv += matrica[i][j];
- }
- else if(i < x && j < y) {
- vtor += matrica[i][j];
- }
- else if(i >= x && j < y) {
- tret += matrica[i][j];
- }
- else {
- cetvrt += matrica[i][j];
- }
- }
- }
- printf("%d %d %d %d\n", prv, vtor, tret, cetvrt);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement