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 fjnu105042003001 at 2006-07-13 10:37:01 on Problem 1060
In Reply To:不是简单的多项式乘除吗。怎么wa了n次,有什么陷阱???高手帮忙看看!! Posted by:bbskill at 2004-04-16 22:24:13
#include <iostream>
using namespace std;
int main()
{
	int f[1001],g[1001],fg[3001],h[2001];
	int lf,lg,lh;
	int test,i,s;
	cin>>test;
	while(test--)
	{
		memset(fg,0,sizeof(fg));
		cin>>lf;
		for(i=lf-1;i>=0;i--)
			cin>>f[i];
		cin>>lg;
		for(i=lg-1;i>=0;i--)
			cin>>g[i];
		cin>>lh;
		for(i=lh-1;i>=0;i--)
			cin>>h[i];
		for(i=0;i<lg;i++)
		{
			if(g[i]!=0)
				for(s=0;s<lf;s++)
					if(f[s]!=0)
						fg[i+s]=(fg[i+s]+1)%2;
		}
		for(i=lg+lf-2;i>=lh-1;i--)
		{	
			if(fg[i]==1)
				for(s=lh-1;s>=0;s--)
					fg[i-(lh-1-s)]=(fg[i-(lh-1-s)]+h[s])%2;
		}
		for(i=lh-1;i>=0;i--)
			if(fg[i]==1)
				break;
		if(i>=0)
			cout<<i+1;
		else
			cout<<(++i)+1;
		for(;i>=0;i--)
			cout<<" "<<fg[i];
		cout<<endl;
	}
	return 1;
}


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