Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
runtime error 求救#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator