Advertisement
Josif_tepe

Untitled

Apr 16th, 2021
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.85 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int niza[7];
  8.     int matrica[5][6];
  9.     for (int i = 0; i < 7; i++)
  10.     {
  11.         cin >> niza[i];
  12.  
  13.     }
  14.     for (int i = 0; i < 5; i++)
  15.     {
  16.         for (int j = 0; j < 6; j++)
  17.         {
  18.             cin >> matrica[i][j];
  19.         }
  20.  
  21.     }
  22.     int kolku_pati[31];
  23.     for (int i = 0; i < 31; i++)
  24.     {
  25.         kolku_pati[i] = 0;
  26.     }
  27.     for (int i = 0; i < 5; i++)
  28.     {
  29.         for (int j = 0; j < 6; j++)
  30.         {
  31.             kolku_pati[matrica[i][j]] += 1;
  32.         }
  33.     }
  34.     int da = 1;
  35.     for (int i = 0; i < 7; i++)
  36.     {
  37.         if (kolku_pati[niza[i]] > 0)
  38.         {
  39.             kolku_pati[niza[i]] -= 1;
  40.         }
  41.         else {da = -1;}
  42.     }
  43.     if (da == 1)
  44.     {
  45.         cout << "DA" << endl;
  46.     }
  47.     else {cout << "NE" << endl;}
  48.     return 0;
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement