// poj 1141 Brackets Sequence
// 也是在紫书上看的一题,uva就是多了一个t组数据。
// 经典区间dp
// dp(i,j)表示区间[i,j]内所需要增加的括号数目
// 则分为两种情况
// 一种是s[i]和s[j]是匹配的则
// dp[i][j] = min(dp[i][j],dp[i+1][j-1])
// 另外一种情况是不匹配
// dp[i][j] =...
分类:
其他好文 时间:
2015-05-05 00:05:14
阅读次数:
147
题目描述
Given a string containing just the characters '(', ')', '{', '}', '[' and ']',
determine if the input string is valid.
The brackets must close in the correct order, "()" and "()[]{}" ar...
分类:
其他好文 时间:
2015-05-03 14:42:13
阅读次数:
193
D - Coloring Brackets
Time Limit:2000MS Memory Limit:262144KB 64bit IO Format:%I64d
& %I64u
Submit Status Practice CodeForces
149D
Description
Once Petya read a problem about...
分类:
其他好文 时间:
2015-05-02 09:43:12
阅读次数:
220
http://codeforces.com/problemset/problem/149/D
题目大致意思是给你一串字符串,只有小括号,并且已经符合括号匹配规则,现在要给这些括号涂色,给出一些涂色规则,求涂色的方案数。
1: 括号要么不被涂色,要么被涂成蓝色,要么被涂成红色。
2:两个相互匹配的括号有且仅有一个被涂色。
3:相邻两个括号不可以有相同颜色。
这里当然也是想到对区 [l,...
分类:
其他好文 时间:
2015-04-30 08:55:37
阅读次数:
127
http://poj.org/problem?id=2955
题目大意是给你一个字符串,字符串由中括号和小括号组成,问该串里的最长的一个符合数学括号匹配规范的子序列是多长。
一开始打算用传说中的左闭右开区间来写,后来发现果然不适合我,还是换回左闭右闭区间写了。
dp的思路比较简单,dp[i][j] 表示从 i 到 j 的串种符合括号匹配的最长子序列。对于任意一个区间均可以存在一个...
分类:
其他好文 时间:
2015-04-30 08:53:25
阅读次数:
128
http://poj.org/problem?id=2955题目大意是给你一个字符串,字符串由中括号和小括号组成,问该串里的最长的一个符合数学括号匹配规范的子序列是多长。一开始打算用传说中的左闭右开区间来写,后来发现果然不适合我,还是换回左闭右闭区间写了。dp的思路比较简单,dp[i][j] 表示从...
分类:
其他好文 时间:
2015-04-30 00:47:36
阅读次数:
135
Given a string containing just the characters'(',')','{','}','['and']', determine if the input string is valid.The brackets must close in the correct ...
分类:
其他好文 时间:
2015-04-23 21:31:47
阅读次数:
127
Valid Parentheses
Given a string containing just the characters '(', ')', '{', '}', '[' and ']',
determine if the input string is valid.
The brackets must close in the correct order, "()" an...
分类:
其他好文 时间:
2015-04-21 20:46:55
阅读次数:
128
题目:Given a string containing just the characters'(',')','{','}','['and']', determine if the input string is valid.The brackets must close in the corre...
分类:
其他好文 时间:
2015-04-17 13:33:47
阅读次数:
82
Given a string containing just the characters'(',')','{','}','['and']', determine if the input string is valid.The brackets must close in the correct ...
分类:
其他好文 时间:
2015-04-14 14:15:23
阅读次数:
108