UVA11988 Broken Keyboard (a.k.a. Beiju Text)【数组模拟链表】
参考: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)【数组模拟链表】的更多相关文章
- 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 ...
- UVA-11988 Broken Keyboard (a.k.a. Beiju Text) (链表 或 递归)
题目大意:将一个字符串改变顺序后输出.遇到“[”就将后面内容拿到最前面输出,遇到“]”就将后面的内容拿到最后面输出. 题目分析:用nxt[i]数组表示i后面的字符的下标,实际上就是以字符i为头建立链表 ...
- UVa11988 Broken Keyboard (a.k.a. Beiju Text)
题目复制太麻烦了,甩个链接 http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=18693 直接模拟光标操作时间复杂度较高,所以用链 ...
- 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 ...
- 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 ...
- 破损的键盘(悲剧文本)(Broken Keyboard(a.k.a. Beiju Text),Uva 11988)
破损的键盘(悲剧文本)(Broken Keyboard(a.k.a. Beiju Text),Uva 11988) 题意描述 你在输入文章的时候,键盘上的Home键和End键出了问题,会不定时的按下. ...
- 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:% ...
- 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 ...
- UVA 11988 Broken Keyboard (a.k.a. Beiju Text)(链表)
题目代号:UVA 11988 题目链接:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&pa ...
随机推荐
- Extjs 自动列宽
//auto column width Ext.grid.Panel.prototype.viewConfig = { listeners: { refresh: function (dataview ...
- 【Leetcode】【Medium】Single Number II
Given an array of integers, every element appears three times except for one. Find that single one. ...
- May 22nd 2017 Week 21st Monday
The biggest adventure you can take is to live the life of your dreams. 你能经历的最大的冒险,就是过上你梦想的生活. Just l ...
- OA环境搭建及卸载操作帮助文档
目 录 项目介绍 JDK的安装与验证 1.安装JDK 2.添加环境变量 3.验证JDK MySql的安装与验 1.安装MySql 2.登录Mysql帐号 3.导入数据库 Tomcat的安装与验证 ...
- 使用intellij idea创建JSP和引入Tomecat包
首先我们需要按照好intellij idea 如果没有安装好,这里有下载按照教程:https://www.cnblogs.com/weibanggang/p/9395702.html 首先我们创建一个 ...
- Failed to resolve: com.android.support:appcompat-v7:23.*
打开 sdk manager ,安装 android support repository.
- some small knowledge
cookie 增查 <!--1.语义化标签的作用--> <!--1.1 从开发角度考虑是提高代码的可读性可维护性--> <!--1.2 网站的发布者:seo 搜索引擎优化 ...
- linux系统状态查看/管理相关命令
系统状态查看命令: w 查看用户 top 系统进程监控 uptime 查看某台服务器运行了多久 htop 更加先进的交互式监控工具(需要安装) iotop 监控并实时显示磁盘IO输入和输出和程序进程( ...
- vue使用v-for循环,动态修改element-ui的el-switch
在使用element-ui的el-switch中,因为要用v-for循环,一直没有成功,后来仔细查看文档,发现可以这样写 <el-switch v-for="(item, key) i ...
- Java虚拟机垃圾回收(三): 7种垃圾收集器(转载)
1.垃圾收集器概述 垃圾收集器是垃圾回收算法(标记-清除算法.复制算法.标记-整理算法.火车算法)的具体实现,不同商家.不同版本的JVM所提供的垃圾收集器可能会有很在差别,本文主要介绍HotSpot虚 ...