Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

狂晕,请教高手,有什么错误?

Posted by ACM05002 at 2005-07-28 19:59:11 on Problem 1060
void main()
{ int t,f[1001],g[1001],h[1001],k[2002],m,n,l,i,j,z;
  scanf("%d",&t);
  while(t--)
  { scanf("%d",&m);
    for(i=m-1;i>=0;i--)
      scanf("%d",&f[i]);
    scanf("%d",&n);
    for(i=n-1;i>=0;i--)
      scanf("%d",&g[i]);
    scanf("%d",&l);
    for(i=l-1;i>=0;i--)
      scanf("%d",&h[i]);
    for(i=0;i<m+n;i++)
      k[i]=0;
    for(i=0;i<m;i++)
      for(j=0;j<n;j++)
        k[i+j]=k[i+j]+f[i]*g[j];
    for(i=0;i<m+n;i++)
      k[i]=k[i]%2;
    for(i=m+n-1;i>=l-1;i--)
      if(k[i]==1)
        for(j=0;j<l;j++)
          k[i-l+1+j]=(k[i-l+1+j]+h[j])%2;
    z=-1;
    for(i=l-2;i>=0;i--)
      if(k[i]==1)
        break;
    z=i;
    printf("%d",z+1);
    for(i=z;i>=0;i--)
      printf(" %d",k[i]);
    if(z==-1) printf(" 0");
    printf("\n");
  }
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator