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 |
NeverWin的代码好臃肿啊。In Reply To:NeverWin的代码写的有点不易懂,但只用了不到1000个字符 Posted by:fanhqme at 2008-10-05 18:23:04 #include <cstdio> #include <string.h> #define xx(z,w) scanf("%d",&z);for (int i=z-1;i>=0;i--)scanf("%d",w+i) using namespace std; int main(){int f[2500],g[2500],h[2500],t[2500],u,q,p,T;scanf("%d",&T);while(T--){memset(f,0,sizeof(f));memset(g,0,sizeof(g));memset(h,0,sizeof(h));memset(t,0,sizeof(t));xx(u,f);xx(q,g);xx(p,h);for(int i=0;i<2500;i++)if (f[i])for (int j=i;j<2500;j++)t[j]=(t[j]^g[j-i]);for (int i=2499;i>=p-1 && i>=0;i--)if (t[i])for(int j=0;j<p;j++)t[j+i-p+1]=(t[j+i-p+1]^h[j]);for(int i=2499;i>=0;i--)if (t[i] || i==0){printf("%d",i+1);for(int j=i;j>=0;j--)printf(" %d",t[j]);printf("\n");break;}}} Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator