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 |
Re:这题吧我给看傻了,楞是没看懂In Reply To:这题吧我给看傻了,楞是没看懂 Posted by:foreverlin at 2009-12-31 19:46:44 > re 我来解释一下题目的意思 一个字符串ch,长度为一个素数-1,下标从1开始(1--length),每个字符要么是‘1’,要么是‘0’,然后在最后面加一个x字符,然后 int i; char mat[length+3][length+3]; char rev[length+3][length+3] for(i=1;i<=length;i++) { for(j=1;j<=length;j++) { k=(i*j)%(length+1); mat[i][j]=ch[k]; } mat[i][j]=0; } for(i=1;i<=length;i++) { for(j=1;j<=length;j++) { if(mat[i][j]='0') rev[i][j]='1'; else rev[i][j]='0'; } rev[i][j]=0; } for(i=2;i<=length;i++) if(strcmp(&mat[i][1],&mat[1][1])==0||strcmp(&rev[i][1],&mat[1][1])==0) continue; else break; if(i>length) { puts("it is a magic bitstring"); } else puts("it is not a magic bitstring"); return 0; 题目用中文很难解释清楚,所以用代码解释一下 此题感觉还是有点难做的,想了一天了才ac Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator