※ 引述《windows2k (KERORO軍曹)》之銘言:
: ※ 引述《JonathanWang (尹兒)》之銘言:
: : 這樣的 f[n][0] 裡面會包含到深度不足 d 的答案
: 少打了一些東西
: 要求的解 為 (深度 <=d 的 f[n][0]) - (深度<=d-1 的f[n][0])
下面這段是別人給我的提示:
At each position, you have two choices: opening bracket and closing bracket.
So dp is table [depth][position] and stores how many ways there are to reach
that. And since you only want to allow maximum depth of d, don't allow bigger
depths when doing dp.
--
win2k的方法感覺比較容易寫
王尹的方法實在很細膩.... :p
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 218.167.22.232