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 val...
分类:
其他好文 时间:
2015-06-30 23:40:25
阅读次数:
285
Given a string containing just the characters'(',')','{','}','['and']', determine if the input string is valid.The brackets must close in the correct ...
分类:
其他好文 时间:
2015-06-30 12:17:09
阅读次数:
82
【题目链接】:click here~~
【题目大意】给定一个逻辑运算符号a->b:当前仅当a为1b为0值为0,其余为1,构造括号,改变运算优先级使得最后结果为0
【解题思路】:
todo~~
/*
思路:
1.如果最后一位是1,无论如何结果不会为0.puts("NO");
2.那么有解的情况下最后一位必为0
2.1.进一步发现,其实倒数第二位必为1,只有1前面的结果和该位1结合...
分类:
其他好文 时间:
2015-06-27 16:41:04
阅读次数:
127
This problem can be solved elegantly using dynamic programming.We maintain two arrays:cnt[i][j] --- number of parentheses needed to add within s[i..j]...
分类:
其他好文 时间:
2015-06-22 19:12:15
阅读次数:
202
题目链接:http://poj.org/problem?id=2955题意:求回文子串的最大长度。解法:枚举区间长度,更新答案。代码:#include
#include
#include
#include
#include
#include
#include
#...
分类:
其他好文 时间:
2015-06-17 21:36:46
阅读次数:
99
Given a string containing just the characters'(',')','{','}','['and']', determine if the input string is valid.The brackets must close in the correct ...
分类:
其他好文 时间:
2015-06-16 01:06:45
阅读次数:
166
Description:Given a string containing just the characters'(',')','{','}','['and']', determine if the input string is valid.The brackets must close in ...
分类:
其他好文 时间:
2015-06-14 10:56:21
阅读次数:
117
题意:给出一个括号串,求最短的满足要求的括号串;思路:枚举长度,枚举起点和终点,找到匹配括号是可递推到子序列,枚举中间指针求最优解;打印时通过记忆表path存储最优解,递归求出最短序列;#include#include#include#define INF 0x7fffffffusing names...
分类:
其他好文 时间:
2015-06-13 21:33:32
阅读次数:
114
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-06-11 17:05:56
阅读次数:
123
Implication is a function of two logical arguments, its value is false if and only if the value of the first argument is true and the value of the second argument is false.
Implication is written b...
分类:
其他好文 时间:
2015-06-09 17:14:18
阅读次数:
90