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 |
数据很弱哈,一次AC (*^__^*)我的代码,请多指教: #include<iostream> using namespace std; char s[30]; char t[30]; void p(int is,int js,int it,int jt) { if(is==js) { cout<<s[is]; return; } if(is>js||it>jt) return ; char root; int k; root=s[is]; for(k=it;k<=jt;k++) { if(t[k]==root) break; } int l=k-it; p(is+1,is+l,it,k-1); p(is+l+1,js,k+1,jt); cout<<root; } int main() { int lenth; while(cin>>s>>t) { getchar(); lenth=strlen(s); p(0,lenth-1,0,lenth-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