| ||||||||||
| 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 | |||||||||
请教括号问题1141我用的不是DP,而是用两次遍历,但是结果是WRONG ANSWER。 第一遍,当出现一个“]”并且前面无"空闲"的"["时,产即补上一个“[”。对“)”类似。并且处理“[)”和“(]”这种情况,做法是变成“[])”和“()]”继续。 第二遍,把未匹配的“(”和“[”匹配掉。 其中的一些细节也考虑了,试了几个数据也没有问题,包括WEB BOARD上的((]](][[](((][](]([[[[([]][(((([([[](]][([([[([](]((][[]([]]](([[]](]]([([]([[[([([][(]((][[(](]([[( 这个例子,结果是再需要50个括号。 我的输出是 ()()[][]()[][[]()()()][]()[]()[][][][()[]][()()()()[()[[]()]][()[()[[()[]()]()()][[]()[]]]()()[[]]()]]()[]()[]()[][][]()[()[][()]()()][[()]()]()[][]() 前面有人给出的是 (([]))[]([])[[]]((()))[]([])([[[[([])]]]])[(((([([[]])]))))]()[([([[([])]])])]()(())[[]]([])(([[]]))()([([])])([[[([([])])]]])[()](())[[()]]()([[()]]) 虽然不一样,但是括号也区配,顺序也对,为什么就WRONG ANSWER呢?请达人指教! Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator