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 |
你的愣是没看懂||=.=。。你看看我的吧。In Reply To:偶滴潮湿代码 Posted by:cuiaoxiang at 2007-10-12 12:26:12 a,b表示段 [a,b] 迭代的时候每次加2不然就会手臂交叉了。。 int dfs (int a, int b) { if (dp[a][b]!=-1) return dp[a][b]; if (a>=b) return 0; int ret = 0; for (int i=a+1; i<=b; i+=2) { int buf = dfs(a+1, i-1)+dfs(i+1, b); if (arr[i]==arr[a]) buf++; if (buf>ret) ret=buf; } dp[a][b] = ret; return ret; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator