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 |
快崩溃了,为什么总是过不了,已经试过好几百次>#include <iostream.h> >int n; >int i,m,j,num; >char win,temp; >int cmp(char c1,char c2) >{ > if(c1=='S') > {if(c2=='C') > return 1; > else > return 0;} > else if(c1=='F') > {if(c2=='S') > return 1; > else > return 0;} > else > {if(c2=='F') > return 1; > else > return 0;} >} > >void main() >{ cin>>n; >char * A=new char[n]; > int * I=new int[n]; > int * J=new int[n]; > m=n; > for(i=0;i<n;i++) > { cin>>A[i]; } > for(i=0;i<n;i++) > {I[i]=0; > J[i]=0;} > do{ > win=A[0]; > for(i=1;i<m;i++) > { if(cmp(win,A[i])) > { win=A[i]; > j=i;} > > } > if((j+m-n+1)%m==0) > J[n-1]=m; > else > J[n-1]=(j+m-n+1)%m; > temp=A[0]; > for(i=1;i<m;i++) > {A[i-1]=A[i];} > A[m-1]=temp; > j=0; > }while(--n>0); > > for(i=0;i<m;i++) > { ++I[*(J+i)-1];} > for(i=0;i<m;i++) > { if(I[i]!=0) > num++; } > > cout<<num<<endl; >} Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator