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 tzkq at 2009-02-19 21:22:27 on Problem 1068 and last updated at 2009-02-19 21:23:17
static String p(String s){
	if(s.length()==0)return "";
	int t=s.charAt(s.length()-1)-48;
	if(t==s.length())
          return '('+p(s.substring(0,s.length()-1))+')';
	else return p(s.substring(0,s.length()-t))+p(s.substring(s.length()-t));
}

java代码 递归思想 仅是把第二种化成括号形式

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