题目传送门

题意:训练指南P244

分析:链表模拟,维护链表的head和tail指针

#include <bits/stdc++.h>
using namespace std; const int N = 1e5 + 5;
struct Link_list {
char ch;
Link_list *nex;
}link_list[N]; int main(void) {
while (true) {
Link_list *head = link_list;
Link_list *q = link_list + 1;
head -> nex = NULL;
Link_list *tail = head, *pos = head;
char c;
while (true) {
c = getchar ();
if (c == '\n') break;
if (c == EOF) return 0;
if (c != '[' && c != ']') {
Link_list *p = q++;
p -> ch = c;
p -> nex = pos -> nex;
pos -> nex = p;
pos = p;
if (tail -> nex != NULL) tail = pos;
}
else if (c == '[') pos = head;
else pos = tail;
}
Link_list *p = head -> nex;
while (p) {
printf ("%c", p -> ch);
p = p -> nex;
}
puts ("");
} return 0;
}

  

链表 UVA 11988 Broken Keyboard (a.k.a. Beiju Text)的更多相关文章

  1. UVA——11988 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 it’s ...

  2. UVA 11988 Broken Keyboard (a.k.a. Beiju Text)(链表)

    题目代号:UVA 11988 题目链接:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&pa ...

  3. UVa 11988 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 ...

  4. UVA 11988 Broken Keyboard (a.k.a. Beiju Text) (链表,模拟)

    使用list来模拟就行了,如果熟悉list,那么这道题真是分分钟秒掉... list是双向循环链表,插入和删除操作非常快,缺点是不能像数组一样随机按下标读取. 一下是wiki上说明的相关函数:http ...

  5. UVa 11988 Broken Keyboard (a.k.a. Beiju Text)

    题目复制太麻烦了,甩个链接 http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=18693 直接模拟光标操作时间复杂度较高,所以用链 ...

  6. 暑假集训单切赛第二场 UVA 11988 Broken Keyboard (a.k.a. Beiju Text)(字符串处理)

    一开始不懂啊,什么Home键,什么End键,还以为相当于括号,[]里的东西先打印出来呢.后来果断百度了一下. 悲催啊... 题意:给定一个字符串,内部含有'['和']'光标转移指令,'['代表光标移向 ...

  7. UVa 11988 - Broken Keyboard (a.k.a. Beiju Text) 题解

    刘汝佳的题目,悲剧文本 -_-||| 这里使用vector<string>容器倒置记录数据,然后从后面输出就能够了. 难度就是不知道这种文档究竟哪里是開始输出,故此使用动态管理内存的容器比 ...

  8. 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 ...

  9. 破损的键盘(悲剧文本)(Broken Keyboard(a.k.a. Beiju Text),Uva 11988)

    破损的键盘(悲剧文本)(Broken Keyboard(a.k.a. Beiju Text),Uva 11988) 题意描述 你在输入文章的时候,键盘上的Home键和End键出了问题,会不定时的按下. ...

随机推荐

  1. css样式设置图片半透明度,兼容IE8,火狐

    关于背景颜色透明的兼容浏览器的问题,一直是个问题,我所写的兼容IE8,和火狐,说是兼容所有浏览器我就没有测试,有兴趣的朋友可以自己测试下吧. background-color:white;filter ...

  2. 用线框模式绘制多边形 glPolygonMode

    glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); glBegin(GL_TRIANGLES);//开始以g_ViewMode模式绘制 glColor3ub(182. ...

  3. python处理html的table标签

    转载:http://www.xuebuyuan.com/583071.html python处理html的table标签 2012年01月06日 ⁄ 综合 ⁄ 共 5279字 ⁄ 字号 小 中 大 ⁄ ...

  4. mysql列类型

    mysql三大列类型 整型 tinyint(占据空间:1个字节 存储范围  有符号  -128-127   无符号  0-255) smallint   mediumint    int    big ...

  5. jq 轮播图

    <style> #focus{width:500px;height:200px;overflow:hidden;/*用一个div把图片包含设置超出范围隐藏*/} </style> ...

  6. Android Message Handling Mechanism

    转自:http://solarex.github.io/blog/2015/09/22/android-message-handling-mechanism/ Android is a message ...

  7. ytu 1058: 三角形面积(带参的宏 练习)

    1058: 三角形面积 Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 190  Solved: 128[Submit][Status][Web Boar ...

  8. 攻城狮在路上(贰) Spring(二)--- Spring IoC概念介绍

    一.IoC的概念: IoC(控制反转)是Spring容器的核心.另一种解释是DI(依赖注入),即让调用类对某一个接口的依赖关系由第三方注入,以移除调用类对某一个接口实现类的一览. 定义如此,由此可见, ...

  9. OS X thrift setup

    OS X Setup The following command install all the required tools and libraries to build and install t ...

  10. ubuntu初始化root帐号密码

    Ubuntu Kylin 14.04的安装过程中并没有提供设置root密码的过程,取而代之的是自定义的帐号. 如果我们需要使用到root帐号或者root权限,则需要重新设置root帐号的密码. 设置方 ...