题目链接

【题解】

模拟题

【代码】

class Solution {
public:
string inttostr(int x){
string temp="";
while (x>0){
char key = (x%10)+'0';
temp= key+temp;
x/=10;
}
return temp;
}
string countAndSay(int n) {
string a = "1";
string b = "";
for (int i = 0;i < n-1;i++){
int len = a.size();
for (int j = 0;j < len;j++){
int k = j;
while (k+1<len && a[k+1]==a[k]) k++;
int num = k-j+1;
string snum = inttostr(num);
snum=snum+a[k];
b = b+snum;
j= k;
}
a = b;
b = "";
}
return a;
}
};

最新文章

  1. 使用spawn-fcgi管理php-cgi
  2. kakfa的常用命令总结
  3. 本地替换文件读取MYSQL密码
  4. hdoj 5392 Infoplane in Tina Town
  5. Object c中的alloc和init问题
  6. 1471. Tree(LCA)
  7. [转]setTimeout() 函数未定义错误
  8. Eclipse vs IDEA快捷键对比大全(win系统)
  9. spring 入门级程序示例
  10. .Net Core 2.0+ InfluxDB+Grafana+App Metrics 实现跨平台的实时性能监控
  11. c++ --&gt; sizeof()使用小结
  12. cdh集群认证命令
  13. 关于jstl中碰到的Property &#39;username&#39; not found on type java.lang.String异常
  14. java使用selenium版本不兼容解决汇总
  15. 三个解释——MVC的网址
  16. golang sublime text3 自动补全
  17. odoo开发笔记 -- context上下文
  18. Netty源码分析第7章(编码器和写数据)----&gt;第5节: Future和Promies
  19. bzoj3203【sdoi2013】保护出题人
  20. 什么是J2EE

热门文章

  1. 【HDOJ6579】Operation(线性基)
  2. delphi 加入超链接
  3. CTF | bugku | 秋名山车神
  4. [NOIP2017]逛公园 题解
  5. (转)Windows下安装Docker, GitBash环境配置
  6. UI:UI 目录
  7. Python笔记(一)_基础
  8. css浮动以及清除
  9. 绿盟扫出来个http host 漏洞
  10. springCloud的使用08-----服务链路追踪(sleuth+zipkin)