| ||||||||||
| 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 | |||||||||
Re:无意间发现简单的算法!~我是按照你的这个简单算法编的程序~为什么AC不了呢??????牛人指教下!!In Reply To:无意间发现简单的算法! Posted by:lovexx at 2006-07-25 23:53:44 #include<stdio.h>
#include<string.h>
#include<stdlib.h>
void main()
{
char a[80]={0};
int n;
int i,len,re,ans;
while(scanf("%s",a)!=EOF)
{
len=strlen(a);
n=atoi(a);
re=n*(len+1);
ans=9;
for(i=1;i<len;i++)
{
ans=ans*10+9;
}
if(re==ans)
printf("%s is cyclic\n",a);
else
printf("%s is not cyclic\n",a);
}
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator