标题:Count and Say通过率:25.8%难度:简单The count-and-say sequence is the sequence of integers beginning as follows:1, 11, 21, 1211, 111221, ...1is read off as"...
分类:
其他好文 时间:
2015-01-27 17:55:57
阅读次数:
172
原题地址一个一个模拟肯定要超时,只有生算找规律呗。比如n=4,k=10,先将n=4的所有排列写出来:(1) 1 2 3 4(2) 1 2 4 3(3) 1 3 2 4(4) 1 3 4 2(5) 1 4 2 3(6) 1 4 3 2(7) 2 1 3 4(8) 2 1 4 3(9) ...
分类:
其他好文 时间:
2015-01-27 17:54:23
阅读次数:
123
Longest Collatz sequence
Problem 14
The following iterative sequence is defined for the set of positive integers:
n → n/2 (n is even)
n → 3n + 1 (n is odd)
Using the rule above and starting...
分类:
编程语言 时间:
2015-01-27 13:33:21
阅读次数:
173
【题目】
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 re...
分类:
其他好文 时间:
2015-01-27 13:25:04
阅读次数:
167
开始的时候一直想不到一个合适的状态转移方程;
后面想到可以分别求以中间那个数为终点和起点的最长上升子序列的长度,
然后以这个数为中心数的Wavio Sequence的长度就是其中短的那个值*2-1的值;
然后我们取所有数Wavio Sequence的最大长度作为答案。
这个题目卡了n^2的求最长上升子序列的算法,必须用nlgn算法才能过。
代码如下:
#include
...
分类:
其他好文 时间:
2015-01-27 09:29:57
阅读次数:
183
Problem 2
Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:
1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
By ...
分类:
编程语言 时间:
2015-01-26 22:55:58
阅读次数:
329
Again Palindromes
Input: Standard Input
Output: Standard Output
Time Limit: 2 Seconds
A palindorme is a sequence of one or more characters that reads the same from the left as it does from th...
分类:
其他好文 时间:
2015-01-26 22:50:54
阅读次数:
205
http://poj.org/problem?id=1094
Description
An ascending sorted sequence of distinct values is one in which some form of a less-than operator is used to order the elements from smallest to larges...
分类:
编程语言 时间:
2015-01-25 19:39:31
阅读次数:
185
SubsequenceTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 9050Accepted: 3604DescriptionA sequence of N positive integers (10 #include #inclu...
分类:
编程语言 时间:
2015-01-25 19:25:00
阅读次数:
174
Given an unsorted array of integers, find the length of the longest consecutive elements sequence.For example,Given[100, 4, 200, 1, 3, 2],The longest ...
分类:
其他好文 时间:
2015-01-25 16:34:51
阅读次数:
151