Josif_tepe

Untitled

May 2nd, 2026
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.67 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. int main(){
  5.     int n, m;
  6.     cin >> n >> m;
  7.    
  8.     int A[n][m], B[n][m];
  9.    
  10.     for(int i = 0; i < n; i++) {
  11.         for(int j = 0; j < m; j++) {
  12.             cin >> A[i][j];
  13.         }
  14.     }
  15.    
  16.     for(int i = 0; i < n; i++) {
  17.         for(int j = 0; j < m; j++) {
  18.             cin >> B[i][j];
  19.         }
  20.     }
  21.     int brojac = 0;
  22.    
  23.     for(int i = 0; i < n; i++) {
  24.         for(int j = 0; j < m; j++) {
  25.             if(A[i][j] == B[i][j]) {
  26.                 cout << "[" << i << ", " << j << "]" << endl;
  27.                 brojac++;
  28.             }
  29.         }
  30.     }
  31.     cout << brojac << endl;
  32.  
  33.     return 0;
  34. }
  35.  
  36.  
  37.  
Advertisement
Add Comment
Please, Sign In to add comment