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 |
分享一下我不存括号,不存p数组的思路虽然不存括号,但是还要建立一个数组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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator