Advertisement
AmidamaruZXC

Untitled

Oct 22nd, 2020
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.44 KB | None | 0 0
  1. #include <iostream>
  2. #include <algorithm>
  3. #include <locale>
  4.  
  5. using namespace std;
  6.  
  7. int main() {
  8.     int n, m, x, count = 0;
  9.     bool check;
  10.     cin >> n >> m >> x;
  11.     int** arr = new int*[n];
  12.     for (int i = 0; i < n; i++)
  13.     {
  14.         arr[i] = new int[m];
  15.         check = false;
  16.         for (int j = 0; j < m; j++)
  17.         {
  18.             cin >> arr[i][j];
  19.             if (arr[i][j] == x && !check)
  20.             {
  21.                 count++;
  22.                 check = true;
  23.             }
  24.         }
  25.     }
  26.     cout << count;
  27.     return 0;
  28. }
  29.  
  30.  
  31.  
  32.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement