#2450: 哪裡錯啊

Unknown User

d478. 共同的數 - 簡易版 | From: [219.70.177.35] | 發表日期 : 2009-10-08 22:56

#include <iostream>    
int main()
{  
 int a,n;  
    while(scanf("%d%d",&a,&n)==2)
    {
            
          for(;a>0;a--)
          {
              int t[n],f[n],ans=0,q=0;
              for(int i=0;i<n;i++)
              {
                  scanf("%d",&t[i]);
              }
               for(int i=0;i<n;i++)
              {
                  scanf("%d",&f[i]);
                  for(int j=q+1;j<n;j++)
                  {
                      if(f[i]==t[j])
                      {
                          q=j;
                          ans++;
                          break;
                      }   
                  }   
              }
              printf("%d\n",ans);
          }   
    }

幫我看看3Q^^ 
ZeroJudge Forum