题目描述
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"two 1s"or21.
21is read off as"one 2, thenone 1"or1211.
Given an integer n, generate the nth sequence.
Note: The sequence of integers will be represented as a string.
---------------------------------------
注意题目是求整个序列的第N项,而每一项是其前一项的解释!!!
计数并说序列生成

本文介绍了一种生成计数并说序列的方法,通过解析序列的构造规则,使用C++实现了一个递进算法来生成任意第n项的序列。该算法能够有效地处理字符串并输出指定项。
252

被折叠的 条评论
为什么被折叠?



