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:搞不定啊...,somebody help me!!!!!

Posted by chgsh8089 at 2006-02-27 00:38:48 on Problem 2406
In Reply To:搞不定啊...,somebody help me!!!!! Posted by:chgsh8089 at 2006-02-23 23:01:34
> 是不是漏了什么呀,给个提示好吗?
> #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:
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