Advertisement
noshin98

uva 10341

Jan 9th, 2017
377
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.48 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.     int n, m, a;
  7.     while(scanf("%d%d", &n, &m))
  8.     {
  9.         if(n==0 && m==0) break;
  10.         int cnt=0;
  11.         map<int, int> mp;
  12.  
  13.         for(int i=0; i<n; i++) {
  14.             scanf("%d", &a);
  15.             mp[a]=1;
  16.         }
  17.  
  18.         for(int i=0; i<m; i++) {
  19.             scanf("%d", &a);
  20.             if(mp[a]==1) cnt++;
  21.         }
  22.         printf("%d\n", cnt);
  23.         mp.clear();
  24.     }
  25.     return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement