| ||||||||||
| 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>
using namespace std;
char s[100];
int main()
{
int len,i,j,d,dmax;
bool flag;
while(scanf(" %s",&s)!=EOF && strcmp(s,"*"))
{
len=strlen(s);
if(len<2) { printf("%s is surprising.\n",s); continue;}
dmax=len-1;
flag=true;
for(d=1;d<=dmax ;d++)
for(i=0;i<len && i+d<len ;i++)
for(j=i+1;j<len && j+d<len;j++)
if(s[j]==s[i] && s[j+d]==s[i+d]) {flag=false;goto dis;}
dis:;
if(flag) printf("%s is surprising.\n",s);
else printf("%s is NOT surprising.\n",s);
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator