Problem DescriptionThere are another kind of Fibonacci numbers: F(0) = 7, F(1) = 11, F(n) = F(n-1) + F(n-2) (n>=2).InputInput consists of a sequence o...
分类:
其他好文 时间:
2014-10-27 17:30:21
阅读次数:
151
Brackets SequenceTime Limit: 1000MSMemory Limit: 65536KSpecial JudgeDescriptionLet us define a regular brackets sequence in the following way: 1. Empt...
分类:
其他好文 时间:
2014-10-27 12:15:53
阅读次数:
222
Implement wildcard pattern matching with support for '?' and '*'.
'?' Matches any single character.
'*' Matches any sequence of characters (including the empty sequence).
The matching should cover t...
分类:
其他好文 时间:
2014-10-26 13:08:38
阅读次数:
172
Longest Consecutive SequenceGiven an unsorted array of integers, find the length of the longest consecutive elements sequence.For example,Given [100, ...
分类:
其他好文 时间:
2014-10-26 11:40:45
阅读次数:
111
HDU 5063 Operation the Sequence(暴力 数学)...
分类:
其他好文 时间:
2014-10-25 20:13:58
阅读次数:
186
Fibonacci
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 9650
Accepted: 6856
Description
In the Fibonacci integer sequence, F0 = 0, F1 = 1, and Fn = Fn ?
...
分类:
其他好文 时间:
2014-10-25 17:21:23
阅读次数:
178
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-10-25 16:00:23
阅读次数:
184
The count-and-say sequence is the sequence of integers beginning as follows:1, 11, 21, 1211, 111221, ...1is read off as"one 1"or11.11is read off as"tw...
分类:
其他好文 时间:
2014-10-25 15:50:19
阅读次数:
155
题目大意:将一个非负整数序列切成连续的若干段,使得每一段的和均不超过一定值,在此基础上最小化每一段的最大值的和。
思路:O(N2)的动态规划方程非常明显:
fi=min0≤ji{fj+maxj+1≤k≤i{wk}}
这样利用RMQ的预处理即可做到O(N^2).
不过这样显然是不能AC的。
我们考虑能够进行什么优化。
我们发现以下性质:
(1)fi≤fj(1≤ij≤...
分类:
其他好文 时间:
2014-10-25 09:23:08
阅读次数:
119
题目地址:Ural 1081
先用dp求出每个长度下的合法序列(开头为1)的个数。然后求前缀和。会发现正好是一个斐波那契数列。然后每次判断是否大于此时长度下的最少个数,若大于,说明这一位肯定是1,若小于,则肯定是0.就这样不断输出出来即可。
代码如下:
#include
#include
#include
#include
#include
#include
#include
...
分类:
其他好文 时间:
2014-10-24 23:40:46
阅读次数:
312