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:runtime error 求救

Posted by ckl at 2009-11-06 15:08:47 on Problem 2255
In Reply To:runtime error 求救 Posted by:z1161y at 2009-06-01 19:02:23
> #include <iostream>
> #include <string>
> using namespace std;
> void h(char f[],int i,int j,char m[],int k,int r)
> {
> 	int s;
> 	if(k==r)  cout<<m[k];
> 	else
> 	{
> 		for(s=k;s<=r;s++)
> 		{
> 			if(m[s]==f[i])  break;
> 		}
> 		if(k==s)
> 		{
> 			h(f,i+1,j,m,k+1,r);
> 			cout<<m[s];
> 		}
> 		else if(r==s)
> 		{
> 			h(f,i+1,j,m,k,r-1);
> 			cout<<m[s];
> 		}
> 		else
> 		{
> 			h(f,i+1,s,m,k,s-1);
> 			h(f,s+1,j,m,s+1,r);
> 			cout<<m[s];
> 		}
> 	}
> }
> int main()
> {
> 	char f[27],m[27];
> 	int i,j;
> 	while(scanf("%s %s",f,m)!=EOF)
> 	{
> 		int z=strlen(f);
> 		if(z==1)
> 		{
> 			cout<<f[0]<<endl;
> 		}
> 		else
> 		{
> 			h(f,0,z-1,m,0,z-1);
> 			cout<<endl;
> 		}
> 	}
> 	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