参考:https://blog.csdn.net/lianai911/article/details/41831645

 #include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
using namespace std;
const int N=1e5+;//若在函数内开过大数组,会显示Process returned -1073741571 (0xC00000FD)错误!
string s;
vector<char> v[*N];
int main()
{
std::ios::sync_with_stdio(false);//加快cin,cout效率
std::cin.tie();
// freopen("btext.txt","r",stdin);
while (cin>>s)
{
int st=N,h=N-,e=N+;//st为当前光标,h为头,e为尾
for (int i=;i<*N;i++)
{
v[i].clear();
}
for (unsigned int i=;i<s.length();i++)
{
if (s[i]=='[')
{
st=h;
h--;
continue;
}
if (s[i]==']')
{
st=e;
e++;
continue;
}
v[st].push_back(s[i]);
}
for (int i=h;i<=e;i++)
{
for (unsigned int j=;j<v[i].size();j++)
{
cout<<v[i][j];
}
}
cout<<endl;
} return ;
}

UVA11988 Broken Keyboard (a.k.a. Beiju Text)【数组模拟链表】的更多相关文章

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

  2. UVA-11988 Broken Keyboard (a.k.a. Beiju Text) (链表 或 递归)

    题目大意:将一个字符串改变顺序后输出.遇到“[”就将后面内容拿到最前面输出,遇到“]”就将后面的内容拿到最后面输出. 题目分析:用nxt[i]数组表示i后面的字符的下标,实际上就是以字符i为头建立链表 ...

  3. UVa11988 Broken Keyboard (a.k.a. Beiju Text)

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

  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. 破损的键盘(悲剧文本)(Broken Keyboard(a.k.a. Beiju Text),Uva 11988)

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

  7. N - Broken Keyboard (a.k.a. Beiju Text)(DFS,链表)

    N - Broken Keyboard (a.k.a. Beiju Text) Time Limit:1000MS     Memory Limit:0KB     64bit IO Format:% ...

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

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

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

随机推荐

  1. oracle_great_integration_译文

    website:https://www.oracle.com/corporate/features/great-integrations.html Great Integrations(伟大的整合) ...

  2. php调用含有命名空间的类

    现有a.php 和 b.php在同一个目录下 a.php中 namespace myspace; class A{ __construct(){} .... } b.php中调用类A require_ ...

  3. 1.GlusterFS 初识

    一. GlusterFS 初始 1.1 分布式文件系统出现 计算机通过文件系统管理.存储数据,而现在数据信息爆炸的时代中人们可以获取的数据成指数倍的增长,单纯通过增加硬盘个数来扩展计算机文件系统的存储 ...

  4. Orchard Core 使用工作流处理审批和创建内容项

    译自:http://www.ideliverable.com/blog/orchard-core-workflows-walkthrough-content-approval 转载请注明出处, 原文地 ...

  5. Perl实用中文处理步骤(修改版)

    发信人: FenRagwort (泽), 信区: Perl标  题: Perl实用中文处理步骤(修改版)发信站: 水木社区 (Mon Feb 14 12:52:14 2011), 转信 (修改版 感谢 ...

  6. OC 构造方法

    #import <Foundation/Foundation.h> @interface Student : NSObject { int _age; int _no; } - (void ...

  7. 从零开始Vue项目实战(三)-项目结构

    目录结构 ├── README.md 项目介绍 ├── index.html 入口页面 ├── build 构建脚本目录 │ ├── build-server.js 运行本地构建服务器,可以访问构建后 ...

  8. Ubuntu不支持rpm安装软件解决方法

    Ubuntu不支持rpm安装软件解决方法 以前经常使用的是RedHat Linux,习惯使用rpm方法安装软件.最近发现Ubuntu系统居然不支持rpm方法安装软件,提示信息如下: root@root ...

  9. idea 使用maven构建项目时,target bytecode version经常自动变化

    解决方法:在工程的pom.xml中添加 <build> <plugins> <plugin> <groupId>org.apache.maven.plu ...

  10. 使用Sleep方法延迟时间

    实现效果: 关键知识:(线程的定义) 实现代码: private void Form1_Load(object sender, EventArgs e) { Thread show = new Thr ...