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-11-20 01:20:45
阅读次数:
185
本文是在学习中的总结,欢迎转载但请注明出处:http://blog.csdn.net/pistolove/article/details/41257397
今天OJ可好几次,发现总是出错,最后才发现是自己把题目理解错了,想想就觉得好笑。
题目的意思是给定一个整数n,让你求出按照上面规律在执行若干次后所得到的串,其实该算法主要用到递归的思想。
我却把题目意思错误地理解为:对于给定的整数n,对该整数n执行N次上述递归操作后得到的串。例如给定2,得到的结果是1112。
当我将给定整数设定为1000时,果断出现内...
分类:
其他好文 时间:
2014-11-19 11:18:20
阅读次数:
217
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-12 19:50:50
阅读次数:
164
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-11-10 06:30:28
阅读次数:
178
1 class Solution { 2 public: 3 string countAndSay(int n) { 4 if(n==1) return "1"; 5 string str0="",str1="1"; 6 int i,t,count; 7 ...
分类:
其他好文 时间:
2014-11-08 23:22:00
阅读次数:
291
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-11-04 10:50:13
阅读次数:
180
问题描述:
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...
分类:
其他好文 时间:
2014-10-28 21:49:42
阅读次数:
302
1 ``` 2 class Solution{ 3 string result; 4 public: 5 //根据数组前一个数,count and say 构造出后一个数 6 void generate(string s,string &result) 7 ...
分类:
其他好文 时间:
2014-10-27 22:54:51
阅读次数:
243
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