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 gzt at 2008-08-20 23:06:14 on Problem 1060
In Reply To:大牛们帮忙看看为什么错了,测试数据都是对的,而且没有讨论区中所说的问题 Posted by:lcj0227 at 2007-08-04 23:40:23
#include<iostream>
using namespace std;
//
int a[3][1010];
int b[3];
int c[2020];
int sum;
int now;
//
void _in()
{
	int i,j;
	memset(a,0,sizeof(a));
	memset(b,0,sizeof(b));
	memset(c,0,sizeof(c));
	for(i=0;i<3;i++)
	{
		scanf("%d",&b[i]);
		for(j=0;j<b[i];j++)
			scanf("%d",&a[i][j]);
	}
}
//
void cheng()
{
	int i,j;
	sum=b[0]+b[1]-2;
	memset(c,0,sizeof(c));
	for(i=0;i<=sum;++i)
	{
		for(j=0;j<=i&&j<b[0];++j)
			c[i]^=(a[0][j]&a[1][i-j]);
	}
}
//
void modd()
{
	int i;
	now=0;
	while(now<=sum-b[2]+1)
	{
		if(c[now]==0)
		{
			now++;
			continue;
		}
		for(i=0;i<b[2];i++)
			c[now+i]^=a[2][i];
	}
}
//
int main()
{
	int test,i;
	scanf("%d",&test);
	while(test--)
	{
		_in();
		cheng();
		modd();
		
		while(c[now]==0&&now<=sum)
			now++;
		cout<<sum-now+1;
		for(i=now;i<=sum;i++)
			printf(" %d",c[i]);
		printf("\n");
	}
	return 0;
}

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