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 sfsfwssf at 2010-03-25 16:48:34 on Problem 1068
In Reply To:一点思路 Posted by:0503 at 2008-09-22 19:41:47
> 拿4 5 6666 为例,可知第一个')' 前面有四个'(' ,按照栈的规则,说明第一个')'与第四个'(' 匹配,同理第二个 ')' 与 第五个 '(' 匹配,第三个')' 与第六个 '(' 匹配,
> 在看第四个,由于第六个'('、第五个'('、第四个'('、已经被匹配,所以第四个')' 应该是和
> 第三个'(' 匹配,以此类推。。。。用一个数组保存的匹配的结果(match[]),
>           4 5 6 6 6 6       6
> 匹配结果:4 5 6 3 2 1 ,再以 3 为例,因为在这个')'之前的第四个'('、五个'('、第六个'('已经被匹配,每一次匹配是一个')', 加上本身 所以结果应该是 6-3+1,以此类推结果就出来了。。。 ^_^

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