题目链接: 传送门 Broken Keyboard #include<bits/stdc++.h> using namespace std; char str[100010]; int main() { while(scanf("%s",str)!=EOF) { deque<int > q; int i=0; while(str[i]=='['||str[i]==']') i++; q.push_front(i); while(str[i]) { if(str[…
题目链接: https://cn.vjudge.net/problem/UVA-11988 /* 问题 将一段文本经过一定的规则处理后输出,规则就是[表示home键,表示光标跳到行首,]表示end键,表示光标跳到行末 解题思路 可以发现[]是可以嵌套的,采用纯模拟比较复杂,采用类似KMP中的next数组一样,记录一下每个字符的下一个字符位置,最后 输出即可. */ #include<iostream> #include<cstdio> #include<cstring>…
/*数组形式描述链表:链表不一定要用指针. 题目链接:UVa 11988 Broken Keyboard 题目大意: 小明没有开屏幕输入一个字符串,电脑键盘出现了问题会不定时的录入 home end 两个键, 我们知道如果录入home则将光标定位到字符首,如果录入end则是将光标定位到字符尾.现 在让你输出这段坏了文本. 表示:home => '[' , end => ']' 举例: input: hello[_Tom_]! output: _Tom_hello! 解题思路: 数组中频繁移动元…
You're typing a long text with a broken keyboard. Well it's not so badly broken. The only problem with the keyboard is that sometimes the "home" key or the "end" key gets automatically pressed (internally). You're not aware of this iss…
题目代号:UVA 11988 题目链接:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=3139 You’re typing a long text with a broken keyboard. Well it’s not so badly broken. The only problemwith the keyboard is that…
Problem UVA11988-Broken Keyboard Accept: 5642  Submit: 34937 Time Limit: 1000 mSec Problem Description You’re typing a long text with a broken keyboard. Well it’s not so badly broken. The only problem with the keyboard is that sometimes the “home” ke…
两种方法,直接上代码 STL标准模板库 #include <iostream> #include <list> #include <algorithm> #include <cstdio> using namespace std; const maxn=100000+5; char str[maxn]; typedef list<char> L; int main(){ while(gets(str)){ L l; L::iterator p;…
You have n boxes in a line on the table numbered 1 . . . n from left to right. Your task is to simulate 4 kinds of commands: • 1 X Y : move box X to the left to Y (ignore this if X is already the left of Y ) • 2 X Y : move box X to the right to Y (ig…
1052 Linked List Sorting (25 分)   A linked list consists of a series of structures, which are not necessarily adjacent in memory. We assume that each structure contains an integer key and a Next pointer to the next structure. Now given a linked list,…
这题我是大写的服气,辛辛苦苦搞了个双重链表结果还一直不对,不对就算了,书上源代码打进去还是不对,我能怎么办我也很无奈.不过这题还是让我对双重链表更加了解和运用了!还是可以的! You’re typing a long text with a broken keyboard. Well it’s not so badly broken. The only problem with the keyboard is that sometimes the “home” key or the “end”…