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 |
搞不定啊...,somebody help me!!!!!是不是漏了什么呀,给个提示好吗? #include<iostream> #include<cstring> #include<algorithm> using namespace std; int main() { int i,j,n,t; char*p,k; p=new char[1000000]; while(gets(p)) { if(p[0]=='.'){break;} t=strlen(p); if(t==0)continue; sort(p,p+t); n=1; for(i=0;i<t;i++) { if(p[i]==p[i+1])n++; else break; } if(t%n){n=1;cout<<n<<endl; delete p; p=new char[1000000];continue; } if(n==t){cout<<n<<endl; delete p; p=new char[1000000];continue; } k='/t'; for(i=0,j=n-1;i<=t-n;i+=n,j+=n) { if(p[i]!=p[j]||k==p[i])break; k=p[i]; } if(i>t-n)cout<<n<<endl; else {n=1;cout<<n<<endl;} delete p; p=new char[1000000]; } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator