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:第一题。。留念In Reply To:第一题。。留念 Posted by:never_no at 2010-10-16 23:37:43 > #include<iostream> > #include<string> > using namespace std; > int main() > { > int i,j,t; > char a[100]; > char b[100][2]; > while(cin>>a) > { > if(a[0]=='*') break; > t=0; > for(int k=1;k<=strlen(a)-1;k++) > { > for(i=0;i<strlen(a)-k;i++) > { > b[i][0]=a[i]; > b[i][1]=a[i+k]; > for(j=0;j<i;j++) > { > if(b[i][0]==b[j][0]&&b[i][1]==b[j][1]) > { > t=1; > break; > } > } > if(t==1) break; > } > if(t==1) break; > } > if(t==1) > { > cout<<a<<" is NOT surprising."<<endl; > } > else > { > cout<<a<<" is surprising."<<endl; > } > } > } 为什么j初始不是等于1,而是0 Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator