Advertisement
Josif_tepe

Untitled

Feb 10th, 2022
906
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.40 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main(){
  4.     int a[100][100], m, n, i, j, k, x, y, zbir, br=0;
  5.  
  6.     scanf("%d%d", &m, &n);
  7.  
  8.     for(i=0; i<m; i++){
  9.         for(j=0; j<n; j++)
  10.             scanf("%d", &a[i][j]);
  11.     }
  12.  
  13.     scanf("%d", &k);
  14.  
  15.     zbir=0;
  16.     for(i=0; i<k; i++){
  17.         scanf("%d%d", &x, &y);
  18.  
  19.         if(((x>=0)&&(x<=m-1))&&((y>=0)&&(y<=n-1))){
  20.             zbir+=a[x][y];
  21.             br++;
  22.         }
  23.  
  24.     }
  25.  
  26.     printf("%d", zbir/br);
  27.  
  28.     return 0;
  29. }
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement