Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:无意间发现简单的算法!~我是按照你的这个简单算法编的程序~为什么AC不了呢??????牛人指教下!!

Posted by gaoxingok99 at 2009-08-10 10:01:31 on Problem 1047
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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator