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:汗,完全暴力,过了样例直接交,1A,我就说这么难的题,怎么AC率这么高呢。。。。。。这数据也太弱了吧?

Posted by jiyanmoyu at 2009-09-21 20:13:23 on Problem 2406
In Reply To:汗,完全暴力,过了样例直接交,1A,我就说这么难的题,怎么AC率这么高呢。。。。。。这数据也太弱了吧? Posted by:jiyanmoyu at 2009-09-21 20:11:31
顺便加个AC了的代码,令人无语


#include<cstdio>
#include<cstdlib>
#include<cstring>
char data[1000010];
int main()
{
    int len;
    int n;
    while(scanf("%s",data)&&data[0]!='.')
    {
         len=strlen(data);
         n=1;
         for(int i=1;i<=len/2;++i)
         {
             if(len%i==0)
             {
                bool isSame=true;
                int s1=0,s2=s1+i;
                while(s2!=len)
                {
                     for(int j=0;j<i;++j)
                     {
                         if(data[s1++]!=data[s2++])
                         {
                            isSame=false;
                            break;
                         }
                     }
                     if(!isSame)
                       break;
                }
                if(isSame)
                {
                   n=len/i;
                   break;
                }
             }
         }      
         printf("%d\n",n);                       
    }
    return 0;
}

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