正文

jnu(Round and Round We Go) || stu(1018)2005-08-21 17:37:00

【评论】 【打印】 【字体: 】 本文链接:http://blog.pfan.cn/elva6401/3995.html

分享到:

#include <iostream.h> #include <string.h> #include <fstream.h> ifstream f("c.in"); #define cin f int main() {     char a[61],b[61];     char c[61][61];     while(cin>>a)     {         int pos;         int i,j,k;         int iw=0;         int flag=0;         for(pos=0;pos<strlen(a);pos++)         {             for(i=0;i<strlen(a)-pos;i++)             c[pos][i]=a[i+pos];             for(i=strlen(a)-pos;i<strlen(a);i++)             c[pos][i]=a[i-strlen(a)+pos];             c[pos][strlen(a)]='\0';         }         for(i=1;i<=strlen(a);i++)         {             iw=0;             int flag2=0;             for(j=strlen(a)-1;j>=0;j--)             {                 int k=(a[j]-'0')*i+iw;                 b[j]=k%10+'0';                 iw=k/10;             }             b[strlen(a)]='\0';             int test=0;             for(j=0;j<strlen(a);j++)             {                 if(strcmp(c[j],b)==0)                 {                     flag2=1;                     break;                 }                                  }                 if(flag2==0)                 {                     flag=1;                     goto loop;                 }                     }           loop :             if(flag==1)             cout<<a<<" is not cyclic"<<endl;             else             cout<<a<<" is cyclic"<<endl;                            } }

阅读(2625) | 评论(0)


版权声明:编程爱好者网站为此博客服务提供商,如本文牵涉到版权问题,编程爱好者网站不承担相关责任,如有版权问题请直接与本文作者联系解决。谢谢!

评论

暂无评论
您需要登录后才能评论,请 登录 或者 注册