题意:略

思路:第1个数是1(读作“1有1个”),因此第2个数就是11(读作“1有2个”),因此第3个数就是12(读作“1有1个,2有1个”),因此第4个数是1121(读作“1有2个,2有1个,1有1个”),因此第5个数是122111......懂了吧。

代码:

  1. #include <string>
  2. #include <iostream>
  3. using namespace std;
  4. int main()
  5. {
  6. int d,n;
  7. cin>>d>>n;
  8. ,d+');
  9. ;k<n;k++){
  10. ;
  11. string temp;
  12. while(i<str.size()){
  13. int s=i;
  14. char pre=str[s];
  15. while(i<str.size() && str[i]==pre) i++;
  16. int cnt=i-s;
  17. temp+=,pre)+,cnt+');
  18. }
  19. str=temp;
  20. }
  21. cout<<str;
  22. ;
  23. }

1140 Look-and-say Sequence的更多相关文章

  1. PAT 1140 Look-and-say Sequence

    1140 Look-and-say Sequence (20 分)   Look-and-say sequence is a sequence of integers as the following ...

  2. PAT 1140 Look-and-say Sequence [比较]

    1140 Look-and-say Sequence (20 分) Look-and-say sequence is a sequence of integers as the following: ...

  3. [PAT] 1140 Look-and-say Sequence(20 分)

    1140 Look-and-say Sequence(20 分)Look-and-say sequence is a sequence of integers as the following: D, ...

  4. 1140 Look-and-say Sequence (20 分)

    Look-and-say sequence is a sequence of integers as the following: D, D1, D111, D113, D11231, D112213 ...

  5. PAT Advanced 1140 Look-and-say Sequence (20 分)

    Look-and-say sequence is a sequence of integers as the following: D, D1, D111, D113, D11231, D112213 ...

  6. PAT甲级——1140.Look-and-say Sequence (20分)

    Look-and-say sequence is a sequence of integers as the following: D, D1, D111, D113, D11231, D112213 ...

  7. PTA 1140 1141 1142 1143

    1140 Look-and-say Sequence 思路:模拟 #include<bits/stdc++.h> using namespace std; typedef long lon ...

  8. PAT (Advanced Level) 1140~1143:1140模拟 1141模拟 1142暴力 1143 BST+LCA

    1140 Look-and-say Sequence(20 分) 题意:观察序列D, D1, D111, D113, D11231, D112213111, ...,显然后一个串是对前一个串每一小段连 ...

  9. oracle SEQUENCE 创建, 修改,删除

    oracle创建序列化: CREATE SEQUENCE seq_itv_collection            INCREMENT BY 1  -- 每次加几个              STA ...

随机推荐

  1. Android并发编程之白话文详解Future,FutureTask和Callable

    从最简单的说起Thread和Runnable 说到并发编程,就一定是多个线程并发执行任务.那么并发编程的基础是什么呢?没错那就是Thread了.一个Thread可以执行一个Runnable类型的对象. ...

  2. 【python教程】Python IDE

    PyCharm PyCharm是由JetBrains打造的一款Python IDE. PyCharm具备一般 Python IDE 的功能,比如:调试.语法高亮.项目管理.代码跳转.智能提示.自动完成 ...

  3. Word批量设置表格宽度自动适应页面宽度

    怎么批量修改Word表格的宽度呢.Word表格可根据窗口自动调整表格宽度,使得所有的表格宽度和页面宽度一样. 当页面设置了新的页边距后,所有的表格都需要调整新的宽度.或者文档中有许多大大小小的表格,希 ...

  4. .net操作Oracle数据库步骤及方法

    1.首先安装PL/SQL Developer Oracle客户端软件 2.安装Oracle Instant Client(即时客户端) 安装与配置 配置环境变量ORAClE HOME 地址为insta ...

  5. Ubuntu 配置静态ip的方法

    1. 配置静态ip地址 $sudo vi /etc/network/interfaces 原有内容只有如下两行: auto lo iface lo inet loopback 向末尾追加以下内容: a ...

  6. linux应用之wget命令详解

    wget是linux最常用的下载命令, 一般的使用方法是: wget + 空格 + 要下载文件的url路径 例如: # wget linuxsense.org/xxxx/xxx.tar.gz" ...

  7. vue.js相关资料

    1.https://cn.vuejs.org/v2/guide/ (中文文档)

  8. 数据挖掘算法Analysis Services-基于SQL Server的数据挖掘

    数据挖掘算法(Analysis Services – 数据挖掘) data mining algorithm is a set of heuristics and calculations that ...

  9. 019对象——对象 method_exists property_exists instanceof

    <?php /** * 19 对象 method_exists property_exists instanceof */ //method_exists() 判断方法是否存在,第一个参数对象或 ...

  10. Maven项目中java类报错-Cannot resolve symbol

    电脑蓝屏了,强制重启之后再打开IDEA里面的项目,所有Java类文件都在报Cannot resolve symbo错误,可以确定所有依赖的包都有引用且jar包没有冲突. 经查询找到这个解决方法: 在I ...