Let us define a regular brackets sequence in the following way:1. Empty sequence is a regular sequence.2. If S is a regular sequence, then (S) and [S]...
分类:
其他好文 时间:
2015-09-24 20:58:30
阅读次数:
194
题目大意:给你一个字符串,问其中匹配的括号有多少个? 下面是用记忆化搜索写的。#include#include#include#include#includeusing namespace std;typedef long long LL;const LL INF = 0xfffffff;cons....
分类:
其他好文 时间:
2015-09-24 20:55:19
阅读次数:
161
Brackets功能还是很强大的。 官网:brackets.io常见问题解决:https://github.com/adobe/brackets/wiki/Troubleshooting快捷键:https://github.com/adobe/brackets/wiki/Brackets-Short...
分类:
其他好文 时间:
2015-09-23 06:33:58
阅读次数:
273
Given a string containing just the characters'(',')','{','}','['and']', determine if the input string is valid.The brackets must close in the correct ...
分类:
其他好文 时间:
2015-09-22 13:03:44
阅读次数:
138
题目:Given a string containing just the characters'(',')','{','}','['and']', determine if the input string is valid.The brackets must close in the corre...
分类:
其他好文 时间:
2015-09-16 06:23:35
阅读次数:
147
Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.The brackets must close in the c...
分类:
其他好文 时间:
2015-09-16 00:49:14
阅读次数:
127
Given a string containing just the characters'(',')','{','}','['and']', determine if the input string is valid.The brackets must close in the correct ...
分类:
其他好文 时间:
2015-09-10 15:45:55
阅读次数:
114
题目大意:给一个有小括号和中括号组成的序列,满足题中的三个条件时,是合法的。不满足时是不合法的,问将一个不合法的序列最少添加几个括号可以使之变成合法的。输出最短合法序列。题目分析:这是《入门经典》上的一道例题。如果仅让求最短序列是极简单的,定义dp(i,j)表示将区间 i~j 变为合法添加的最小字符...
分类:
其他好文 时间:
2015-09-08 12:14:14
阅读次数:
183
1 题目Given a string containing just the characters'(',')','{','}','['and']', determine if the input string is valid.The brackets must close in the corr...
分类:
其他好文 时间:
2015-09-03 11:35:56
阅读次数:
122
题意:
现在我们定义一种R串,它必须满足以下条件:
1)当它的字串是空的时候时,那么它是R串。
2)当它是R串时,那么(s)或是[s]也是R串。
3)当a和b都是R串时,那么ab也是R串。
这里我没有完全领悟题目的意思,所以我发现递推不过去。其实它的实质就是括号匹配。
if((a[s]=='('&&a[e]==')')||(a[s]=='['&&a[e]==']'))
dp[s]...
分类:
其他好文 时间:
2015-08-27 00:30:17
阅读次数:
133