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

更正下:还是错误;谁能帮帮我;

Posted by mengde007 at 2009-10-28 19:59:33 on Problem 1047
#include <iostream>
#include <vector>
#include <string>
using namespace std;
vector<bool> t;
char* c1=new char[61];
char* a=new char[121];
void del(char* b)
{
	int length=strlen(b);

	strcpy(a,b);
	strcat(a,b);
	a[2*length]='\0';
	int n,d;	
	bool p;
	char *q;
	for(int j=length;j>0;j--)
	{
		strcpy(c1,b);
		c1[length]='\0';
		n=0,d=0;
		for(int i=length-1;i>=0;i--)
		{
		d=(c1[i]-48)*j+n;
		c1[i]=d%10+48;
		n=d/10;	
		}
		q=strstr(a,c1);
		if(!q)
		{p=0;break;}	
		else p=1;	
	}
	t.push_back(p);
}
int main()
{
	vector<char*> c;
	size_t i;
	while(1)
	{
		bool boo=1;
		char* b=new char[61];
		char *d=b;
		b[0]='\0';
		cin.getline(b,60);
		if(strlen(b)<2||strlen(b)>60){delete []b;break;}
		for(i=0;i<strlen(b);i++)
		if(i<47||i>58)break;
		if(d[i]<'0'||d[i]>'9')break;
		c.push_back(b);
		del(b);
	}
	for(i=0;i<c.size();i++)
	{
		if(t[i]==0)
		cout<<c[i]<<" is not cyclic"<<endl;
		else
		cout<<c[i]<<" is cyclic"<<endl;
	}
	vector<char*>::iterator it=c.begin();
	for(;it!=c.end();++it)
		delete []*it;
	delete []c1;
	delete []a;
	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