UVA 11988——Broken Keyboard (a.k.a. Beiju Text)
题意:给定一个字符串,然后【会将光标跳转到头,】会将光标调到尾,问最后正确的输入。
思路:直接用list来模拟即可,【的时候就在头插,】就在尾插,也可根据递归顺序解。
code:
#include <bits/stdc++.h>
using namespace std;char s[100001];void dfs(int lt,int rt){int st=rt;while (st>=lt&&s[st]!='['&&s[st]!=']') st--;if (s[st]==']') dfs(lt,st-1);for (int i=st+1;i<=rt;i++) printf("%c",s[i]);if (s[st]=='[') dfs(lt,st-1);
}
int main()
{while (~scanf("%s",s)){dfs(0,strlen(s)-1);puts("");}
}
UVA 11988——Broken Keyboard (a.k.a. Beiju Text)相关推荐
- 11988 - Broken Keyboard (a.k.a. Beiju Text)
Broken Keyboard (a.k.a. Beiju Text) You're typing a long text with a broken keyboard. Well it's not ...
- Broken Keyboard (a.k.a. Beiju Text)
原题及翻译 Broken Keyboard (a.k.a. Beiju Text) 破碎的键盘(a.k.a. Beiju Text) You're typing a long text with a ...
- UVA11988 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 problemwit ...
- Broken Keyboard (a.k.a. Beiju Text) UVA - 11988 (链表)
题目链接:https://vjudge.net/problem/UVA-11988 题目大意:输入一个字符串,输出在原本应该是怎么样的? 具体方法是 碰到' [ ' 回到最前面 碰到' ]' 回 ...
- UVa11988 Broken Keyboard (a.k.a. Beiju Text)
题目复制太麻烦了,甩个链接 http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=18693 直接模拟光标操作时间复杂度较高,所以用链 ...
- UVa - 11988 Broken Keyboard(数组模拟链表)
题目链接:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=18693 #include <iostream> #in ...
- 例题6-4 破损的键盘(又名:悲剧文本)(Broken Keyboard(a.k.a. Beiju Text), UVa 11988)
例题6-4 破损的键盘(又名:悲剧文本)(Broken Keyboard(a.k.a. Beiju Text), UVa 11988) 链表的应用 #include<iostream> # ...
- 【刘汝佳代码详解】例题6-4破损的键盘(Broken Keyboard,UVa 11988)
立志用最少的代码做最高效的表达 You're typing a long text with a broken keyboard. Well it's not so badly broken. The ...
- PAT Broken Keyboard (20)
题目描写叙述 On a broken keyboard, some of the keys are worn out. So when you type some sentences, the cha ...
最新文章
- 【安全运维】 linux 系统账户,网络,简易安全加固方案(第一部分),经测试可行...
- Jquery获取外网IP
- 关于安装bitdenfender的问题
- 参考文献中会议名称怎么缩写_期刊缩写查询总结
- Android Jni 例程
- 香港中文大学MMLab期待优秀同学加入~
- Windows遇到ERR_NETWORK_ACCESS_DENIED处理方案
- opencv 仿射变换与透视变换详解
- [算法]在数组中找到一个局部最小的位置
- Junit + Mockito 使用资料整理
- 什么软件能做英语测试卷听力,英语听力app哪个好用-什么英语听力软件最好
- 艾宾浩斯英语单词记忆表格生成器
- 40163 php,【PHP】微信支付JsApi 40163错误
- ︰【】奥立诚生物科技 奥立诚生物科技研发的华龙6号蜈蚣 成养殖行业的亮点
- 微信小程序注册入口和注册流程(完整版图文教程)
- Strawberry Perl 所有版本链接
- 腾讯游戏运营总监酒后吹批:运维工程师这些知识点都不会?赶紧找个地埋了吧!
- 成功解决图像相减全黑问题
- ora-01128,ora-00275
- 平台服务器型号,云平台服务器型号