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:本题怎么做,请高手指点!

Posted by GreedIsGood at 2006-10-31 12:55:48 on Problem 1577
In Reply To:本题怎么做,请高手指点! Posted by:fx at 2006-04-26 19:30:03
还有btree,insert,preorder,自己写吧
void main()
{
	string s[100];
	int total=0,current=0,nextlen,currentlen;
	cin>>s[total];
	while(s[total]!="$")
	{
		total++;
		cin>>s[total];
	}

	while(current!=total)
	{

		currentlen=current;
		while(s[currentlen]!="*"&&s[currentlen]!="$")
			currentlen++;//s currentlen=*

		if(s[currentlen]=="$")
			nextlen=-1;
		else nextlen=currentlen+1;
		currentlen--;
		btree * root=new btree;
		root->food='@';
		while(currentlen!=current-1)
		{

			int len;
			for(int i=0;s[currentlen][i]!='\0';i++);
				len=i;
			for(i=1;i<=len;i++){
				insert(root,s[currentlen][i-1]);

			}
			currentlen--;
		}
		preorder(root);

		current=nextlen;

		cout<<endl;
		if(nextlen==-1)
			break;
	}
}

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