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:分享一下我不存括号,不存p数组的思路

Posted by 5179 at 2008-12-04 22:37:04 on Problem 1068
In Reply To:分享一下我不存括号,不存p数组的思路 Posted by:deathado at 2008-05-31 17:20:35
> 虽然不存括号,但是还要建立一个数组used[]存储每一个左括号的匹配情况.0为未配,1为已配
> 每输入一个p,就从used[p]开始向左边搜  : for(j=p,j>=0,j--), 找到第一个used[j]==0的j,那么当前输入的右括号就与第(p-j+1)个左括号相匹配.将这个值存进w数组里,再标记used[j]=1即可.
> 
> 184K 0ms

嗯,好思路!

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