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:汗,完全暴力,过了样例直接交,1A,我就说这么难的题,怎么AC率这么高呢。。。。。。这数据也太弱了吧?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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator