8 8 1 5 6 9 10 12 16 59 5 6 9 8 15 17 65 98
3
#include<cstdio> #include<cstdlib> #include<cstring> using namespace std; const int max=100005; int a[max]; int main() { int i,j,ans,m,n,s; while(scanf("%d%d",&m,&n)!=EOF){ memset(a,0,sizeof(a)); for(i=0;i<m;++i){ scanf("%d",&s); a[s]=1; } ans=0; for(i=0;i<n;++i){ scanf("%d",&s); if(a[s]==1)ans++; } printf("%d\n",ans); } return 0; }
原文地址:http://blog.csdn.net/r1986799047/article/details/43486353