Uva 11988 Broken Keyboard
来源:互联网 发布:60插件数据库 编辑:程序博客网 时间:2024/05/01 00:59
对于数组来说移动元素是低效的 采用链表实现更为高效
#include <algorithm>#include <iostream>#include <cstring> #include <cstdio> #include <stack>using namespace std; const int MAX = 100010;int last, cur, next[MAX];char s[MAX];int main(){ while(scanf("%s",s + 1) == 1){ int l = strlen(s + 1); last = cur = 0; next[0] = 0; for(int i=1; i<=l; i++){ char c = s[i]; if(c == '[') cur = 0; else if(c == ']') 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;}
0 0
- Uva 11988 Broken Keyboard
- UVa 11988 ------ Broken Keyboard
- uva 11988 Broken keyboard
- UVA 11988(p143)----Broken Keyboard
- UVA 11988 Broken Keyboard 链表
- UVA 11988 Broken Keyboard 【链表】
- UVA 11988 Broken Keyboard (链表)
- uva 11988 - Broken Keyboard (模拟)
- UVa 11988 Broken Keyboard(模拟链表)
- UVA 11988 Broken Keyboard (Beiju Text)
- Broken Keyboard 破损键盘 UVA 11988
- ACM篇:Uva 11988-- Broken Keyboard
- Uva-11988-Broken Keyboard (a.k.a. Beiju Text)
- UVA 11988 Broken Keyboard (a.k.a. Beiju Text)
- uva 11988 Broken Keyboard (a.k.a. Beiju Text)
- UVA 11988 - Broken Keyboard (a.k.a. Beiju Text)
- uva 11988 Broken Keyboard(字符串处理+ STL)
- UVA 11988 Broken Keyboard(链表的使用)
- Objective-C高级编程之内存管理(2)
- 关于多组数据连续输入,求最大值最小值问题
- 模型整理------------区间dp
- android目录分析之“编译生成的out”
- Xcode6 创建.pch文件
- Uva 11988 Broken Keyboard
- ZOJ 3606 Lazy Salesgirl
- 电信猫大亚DB120-WG破解超级密码方法
- hellow word
- 关于typedef的用法总结
- Laravel大型项目系列教程(二)之用户管理
- Manacher算法 O(n)回文子串算法
- 自定义AlertDialog
- #ifndef #define #ifdef 的区别与联系