题目分析:

起初这道题目没有做出来,原因是我一直想把整块区域一并插入,而不是逐个插入。今后做题应该注意这个问题,把问题分解去考虑,也许会少走许多弯路。

下边附上AC代码

#include <cstdio>
#include <cstring>
#include <cctype>
char s[100000 + 10];
int next[100000 + 10];
int main(){
    while(scanf("%s", s + 1) == 1){
        int len=strlen(s+1);
        int cur = 0,last=0;
        next[0] = 0;
        for(int i = 1;i <= len;i++){
            if(s[i] =='['){
                cur=0;
            }
            else if(s[i] ==']'){
                cur=last;
            }
            else {
                next[i]=next[cur];
                next[cur]=i;
                if(cur == last)last = i;
                cur=i;
            }
        }
        for(int i = next[0];i != 0;i = next[i]){
            printf("%c",s[i]);
        }
        printf("\n");

}
    return 0;
}
//

例题6-4 Broken Keyboard UVa11988的更多相关文章

  1. UVa 11998 Broken Keyboard (数组模拟链表问题)

    题目链接: 传送门 Broken Keyboard #include<bits/stdc++.h> using namespace std; char str[100010]; int m ...

  2. UVa 11988 Broken Keyboard(链表->数组实现)

    /*数组形式描述链表:链表不一定要用指针. 题目链接:UVa 11988 Broken Keyboard 题目大意: 小明没有开屏幕输入一个字符串,电脑键盘出现了问题会不定时的录入 home end ...

  3. 1084. Broken Keyboard (20)

    On a broken keyboard, some of the keys are worn out. So when you type some sentences, the characters ...

  4. B - Broken Keyboard (a.k.a. Beiju Text)

    Problem B Broken Keyboard (a.k.a. Beiju Text) You're typing a long text with a broken keyboard. Well ...

  5. uva - Broken Keyboard (a.k.a. Beiju Text)(链表)

    11988 - Broken Keyboard (a.k.a. Beiju Text) You’re typing a long text with a broken keyboard. Well i ...

  6. PAT1084:Broken Keyboard

    1084. Broken Keyboard (20) 时间限制 200 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue On a ...

  7. PAT 1084 Broken Keyboard

    1084 Broken Keyboard (20 分)   On a broken keyboard, some of the keys are worn out. So when you type ...

  8. A1084. Broken Keyboard

    On a broken keyboard, some of the keys are worn out. So when you type some sentences, the characters ...

  9. B - Broken Keyboard (a.k.a. Beiju Text) 数组模拟链表

    You're typing a long text with a broken keyboard. Well it's not so badly broken. The only problem wi ...

随机推荐

  1. 让ConfigurationManager打开任意的配置文件

    VisualStudio的配置文件很好很强大,用来保存数据库连接字符串或键值对都非常方便,只需要通过ConfigurationManager的ConnectionStrings或AppSettings ...

  2. 【源码】初探C#爬虫,持续更新中。。。

       最近看到园子里有人用python做的爬虫软件并且上传的源码,苦于不懂python,便想着用C#也实现一个简易的爬虫软件.于是昨晚花了一个多小时的时间实现了一个简单的爬虫软件,功能十分简单,但是觉 ...

  3. setsockopt

    1.closesocket(一般不会立即关闭而经历TIME_WAIT的过程)后想继续重用该socket:BOOL bReuseaddr=TRUE;setsockopt(s,SOL_SOCKET ,SO ...

  4. Oracle基础(八) 数据完整性

    一.数据完整性 数据完整性要求数据库中的数据具有准确性.准确性是通过数据库表的设计和约束来实现的.为了实现数据完整性,数据库需要做两方面的工作: 确保每行的数据符合要求. 确保每列的数据符合要求. 为 ...

  5. LearnMVC5-AddController

    原创文章,转载必需注明出处:http://www.ncloud.hk/%E6%8A%80%E6%9C%AF%E5%88%86%E4%BA%AB/learnmvc5-addcontroller/ 本人是 ...

  6. Linux查看和改变网卡的一些信息

    昨天遇到一个问题,就是网卡的速率问题.本身是1000Mb,可是显示为10Mb,这个问题对于我这个菜鸟来说是个难以解决的问题.当然,第一件事是查询Linux中哪个命令能 改变网卡的速率. localho ...

  7. HDU 3038 How Many Answers Are Wrong (并查集)

    How Many Answers Are Wrong Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Ja ...

  8. js 实现angylar.js view层和model层双绑定(改变view刷新 model,改变model自动刷新view)

    近段时间研究了下angular.js 觉得它内部实现的view和model层之间存在很微妙的关系,如下图 如上图说的,view的改变会update 数据层model, 数据层会update视图层vie ...

  9. css reset及部分layout样式

    /*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */html { font-family: sans ...

  10. 【转载】Dubbo与Zookeeper、SpringMVC整合和使用(负载均衡、容错)

    http://blog.csdn.net/congcong68/article/details/41113239 互联网的发展,网站应用的规模不断扩大,常规的垂直应用架构已无法应对,分布式服务架构以及 ...