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 |
tianqing//怎么是wa呀?有那位大家帮忙家决一下!??谢谢!! # include <iostream.h> # include <string.h> char ss[68]; int n; int c(char * s,int n) { int i; char ss1[34]; if(n%2) return 0; for(i=n/2;i<n;i++) { ss1[i-n/2]=s[i]; //cout<<ss1[i-n/2]; } //cout<<"\n"; for(i=0;i<n/2;i++) { ss1[i]=ss1[i]-'0'+s[i]; if(ss1[i]!='9') return 0; } return 1; } int main() { while(cin>>ss) { n=strlen(ss); //cout<<"n======"<<n<<"\n"; if(c(ss,n)) cout<<ss<<" is cyclic\n"; else cout<<ss<<" is not cyclic\n"; } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator