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 |
我觉得我写的算法没问题,而且测试的数据都没问题,但是为什么是wa呢?#include <iostream> using namespace std; int main() { char str[80]; while(scanf("%s",str),strcmp(str,"*")!=0) { int strl=strlen(str); for(int i=1;i<=strl;i++) { int flag=0; for(int j=0;j<=i-2;j++) { for(int k=j+1;k<=strl-i;k++) if(str[j]==str[k]&&str[j+i]==str[k+i]) {cout<<str<<" is NOT surprising."<<endl;flag=1;break;} } if(flag==1) break; if(i==strl) cout<<str<<" is surprising."<<endl; } } system("pause"); return (0); } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator