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 |
想法是对的啊。。why wa 呢?#include<stdio.h> #include<string.h> int mark[30][30]; int a[90],len; bool issurp() { memset(mark,0,sizeof(mark)); for(int k=1;k<len;k++)//间距 { for(int i=0;i+k<len;i++) if(mark[a[i]][a[i+k]]==k) return false; else mark[a[i]][a[i+k]] = k; } return true; } int main() { char s[90]; while(gets(s)){ len=strlen(s); if(len==1&&s[0]=='*') break; for(int i=0;i<len;i++) a[i]=s[i]-'A'; printf("%s is ",s); if(!issurp()) printf("not "); puts("surprising."); } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator