Advertisement
Josif_tepe

Untitled

Aug 24th, 2023
903
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.68 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. int main(int argc, const char * argv[]) {
  4.     int n, m;
  5.     scanf("%d%d", &n, &m);
  6.    
  7.     int mat1[n][m];
  8.     int mat2[n][m];
  9.    
  10.     for(int i = 0; i < n; i++) {
  11.         for(int j = 0; j < m; j++) {
  12.             scanf("%d", &mat1[i][j]);
  13.         }
  14.     }
  15.    
  16.     for(int i = 0; i < n; i++) {
  17.         for(int j = 0; j < m; j++) {
  18.             scanf("%d", &mat2[i][j]);
  19.         }
  20.     }
  21.     int brojac = 0;
  22.     for(int i = 0; i < n; i++) {
  23.         for(int j = 0; j < m; j++) {
  24.             if(mat1[i][j] == mat2[i][j]) {
  25.                 brojac++;
  26.             }
  27.         }
  28.     }
  29.     printf("%d\n", brojac);
  30.     return 0;
  31.    
  32. }
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement