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

Re:这题吧我给看傻了,楞是没看懂

Posted by zsasuke at 2010-03-17 17:50:52 on Problem 2461 and last updated at 2010-03-17 17:52:54
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:
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