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<stdio.h> #include<stdlib.h> #include<math.h> #include<string.h> #include<iostream> #include<algorithm> using namespace std; int num[100000]; int main() { int i,j,k,l,m,n; char a[85]; while(scanf("%s",a)!=EOF&&strcmp(a,"*")) { l=strlen(a); int g=0; for(i=1;i<l;i++) { memset(num,0,sizeof(num)); k=i;j=0;m=-1000;n=-1000; while(k<l) { m=a[k]-a[j]; num[j]=m; k++;j++; if(m==n&&m!=-1000) { printf("%s is NOT surprising.\n",a); //return 1; g=1; break; } if(m!=n) n=m; } if(g) break; else { sort(num,num+j); for(int ii=0;ii<j-1;ii++) { if(num[ii]==num[ii+1]) { g=1; printf("%s is NOT surprising.\n",a); break; } } } if(g) break; } if(!g) printf("%s is surprising.\n",a); } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator