Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
我的可以耶..看不出来有什么区别...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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator