DescriptionWe give the following inductive definition of a “regular brackets” sequence:the empty sequence is a regular brackets sequence,ifsis a regul...
分类:
其他好文 时间:
2015-08-12 21:36:29
阅读次数:
102
使用 Brackets 实时预览功能调试 CSS 样式时,添加如下代码到页面,可以帮助制定选择器。CSS样式:JS代码:显示效果:
分类:
其他好文 时间:
2015-08-11 08:26:22
阅读次数:
184
题目Given a string containing just the characters ‘(‘, ‘)’, ‘{‘, ‘}’, ‘[’ and ‘]’, determine if the input string is valid.The brackets must close in the correct order, “()” and “()[]{}” are all valid but...
分类:
其他好文 时间:
2015-08-09 17:11:15
阅读次数:
102
区间DP
贴个代码
#include
#include
#include
using namespace std;
int check(char a,char b)
{
if(a=='(' && b==')')
return 1;
if(a=='[' && b==']')
return 1;
return 0;
}
in...
分类:
其他好文 时间:
2015-08-04 23:00:57
阅读次数:
201
Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.The brackets must close in the c...
分类:
其他好文 时间:
2015-08-04 12:47:42
阅读次数:
87
染色有三个条件:对于每个点来说要么不染色,要么染红色,要么染蓝色对于每对配对的括号来说,有且只有一个一边的括号被染色相邻的括号不能染成相同的颜色首先可以根据给出的括号序列计算出括号的配对情况,具体来说就是第i个括号与R[i]个括号配对。对于一个正规配对括号序列(correct bracket seq...
分类:
其他好文 时间:
2015-08-02 23:04:01
阅读次数:
211
求一个括号的最大匹配数,这个题可以和UVa 1626比较着看。注意题目背景一样,但是所求不一样。回到这道题上来,设d(i, j)表示子序列Si ~ Sj的字符串中最大匹配数,如果Si 与 Sj能配对,d(i, j) = d(i+1, j-1)然后要枚举中间点k,d(i, j) = max{ d(i,...
分类:
其他好文 时间:
2015-08-02 16:27:16
阅读次数:
101
这个题,哈哈,很无语。
题意:给出所有左括号跟右括号之间合法的距离,求出一个合法的括号序列。
由于括号肯定是快点匹配完最好,所以维护一个栈,若当前的左括号可以被匹配那就匹配否则丢一个左括号进去。
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#...
分类:
其他好文 时间:
2015-07-31 18:23:56
阅读次数:
144
区间DP#include#include#include#includeusing namespace std;char s[1000];int dp[105][105];int main(){ int i,j,k; while(~scanf(" %s",s)) { ...
分类:
其他好文 时间:
2015-07-30 11:04:38
阅读次数:
155
Given a string containing just the characters'(',')','{','}','['and']', determine if the input string is valid.The brackets must close in the correct ...
分类:
其他好文 时间:
2015-07-29 22:45:22
阅读次数:
142