Advertisement
Malinovsky239

УРКОП 2011: H

Oct 22nd, 2011
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | None | 0 0
  1. #include <cstdio>
  2. #include <iostream>
  3.  
  4. #define N 4005
  5.  
  6. using namespace std;
  7.  
  8. int a[3][N], n[3], res = 0;
  9.  
  10. int main() {
  11.     for (int i = 0; i < 3; i++) {
  12.         cin >> n[i];
  13.         for (int j = 0; j < n[i]; j++)
  14.             cin >> a[i][j];
  15.     }
  16.  
  17.     for (int i = 0; i < n[0]; i++) {
  18.         int cnt = 0;
  19.         for (int j = 1; j < 3; j++)
  20.             for (int k = 0; k < n[j]; k++) {
  21.                 if (a[j][k] == a[0][i])
  22.                     cnt++;
  23.             }
  24.  
  25.         if (cnt == 2) res++;
  26.     }
  27.  
  28.     cout << res;
  29.  
  30.     return 0;
  31. }
  32.  
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement