看来最不擅长的就是贪心,这种方法都想不起来是不是专题刷多了? 也没见得专题做得有多好啊~
题目大意:
给出一个字符串,包括三种字符'('、')'、'?',每个问号可以变成其他两种符号,但是需要费用。
要求组成一个符合条件的字符串,使括号匹配,求最小费用。
解题思路:
贪心(发现他比动态规划都难)。
不需要在意哪个括号和哪个括号匹配,只需要注意数量就行...
分类:
其他好文 时间:
2014-11-25 18:36:00
阅读次数:
177
在课程里Week3的一节 "Promises, promises, promises"中,Erik Meijer举了一个例子,实现一个函数:def sequence[T](fs: List[Future[T]]): Future[List[T]] = {.....}这个函数实际在Scala libr...
分类:
其他好文 时间:
2014-11-25 15:55:43
阅读次数:
181
非变易算法/*第21章 非变易算法 Non-modifying sequence operations 21.0 advance, distance 为了了解模板,先了解一下这两个迭代器操作函数 21.1 逐个容器元素for_each for_each Apply...
分类:
编程语言 时间:
2014-11-25 14:07:14
阅读次数:
233
The count-and-say sequence is the sequence of integers beginning as follows:
1, 11, 21, 1211, 111221, ...
1 is read off as "one
1" or 11.
11 is read off as "two
1s" or 21.
21 is read off as ...
分类:
其他好文 时间:
2014-11-25 10:53:43
阅读次数:
238
Sequence operation
Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 6397 Accepted Submission(s): 1899
Problem Description
lxhgww...
分类:
其他好文 时间:
2014-11-25 10:49:42
阅读次数:
260
Number Sequence
Time Limit: 1000MS
Memory Limit: 10000K
Total Submissions: 34391
Accepted: 9879
Description
A single positive integer i is given. Write a program to f...
分类:
其他好文 时间:
2014-11-24 22:33:34
阅读次数:
266
The Sequence objectSome examples will also require a working internet connection in order to run.>>> from Bio.Seq import Seq>>> from Bio.Alphabet impo...
分类:
编程语言 时间:
2014-11-24 22:07:43
阅读次数:
297
http://tedlab.mit.edu/~dr/gdbintro.htmlhttp://emacser.com/emacs-gdb.htmCxd: 打开目录C-x spaceIf you type this sequence while your cursor is in your source...
分类:
数据库 时间:
2014-11-24 16:41:06
阅读次数:
256
第四章 视频编码基础1. 压缩码流语法:码流中各个元素的位置关系01001001…图像编码类型(01),宏块类型(00),编码系数1001等语义:每个语法元素所表达的意义。例如:图像编码类型2. 编码层次序列(Sequence)图像组(Group of Pictures,GOP)图像(Picture...
分类:
其他好文 时间:
2014-11-24 16:40:05
阅读次数:
281
题意:
一个严格递增序列 某些数字的某些位被盖住了 求 恢复后的序列
思路:
贪心 让每个数在大于前一个的基础上尽量的小
先讨论数字长度
len[i]
len[i]>len[i-1] 除了第一位如果是?就填1以外 其他?全填0
len[i]==len[i-1] dfs搜索num[i]格式下大于num[i-1]的最小的数
代码:
#include
#include
#in...
分类:
其他好文 时间:
2014-11-24 11:58:00
阅读次数:
221