返回列表 發帖
本帖最後由 chuangjoy 於 2010-11-6 11:20 編輯
  1. #include <iostream> //引入函數庫
  2. #include <cstdlib>
  3. using namespace std;
  4. int main(void){

  5.     unsigned i,n,j,N,c,k;
  6.     cin >> n >> N;
  7.    
  8.      for(i=0;i<n;i++)
  9.      {
  10.       unsigned long s[200000]={0};
  11.           c=0;
  12.           for(j=0;j<N;j++)
  13.           {
  14.               cin >> k;
  15.               s[k]=1;
  16.           }
  17.           for(j=0;j<N;j++)
  18.           {              
  19.               cin >> k;
  20.               if(s[k] == 1){
  21.                       c++;
  22.               }
  23.           }
  24.       cout << c << endl;
  25.       }

  26.     system("pause");
  27.     return 0;
  28. }
複製代碼

TOP

返回列表