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

tianqing

Posted by tzj115 at 2007-07-04 22:05:26 on Problem 1047
//怎么是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:
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