SSU- 397 Text Editor
簡單模擬題 連結串列還是用的不清楚
#include<stdio.h>
#include<iostream>
#include<string>
#include<string.h>
#include<math.h>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
const int maxn = 1000005;
int pos,now;
struct Node
{
char ch;
int pre,next;
}node[maxn];
int main()
{
//freopen("data.txt","r",stdin);
char ch;
now = 0,pos = 0;
node[0].ch = ' '; node[0].pre = -1; node[0].next = -1;
while( 1 ){
ch = getchar();
if( ch == 'L' ){
if( node[now].pre != -1 )
now = node[now].pre;
}
else if( ch == 'R' ){
if( node[now].next != -1 )
now = node[now].next;
}
else if( ch >= 'a' && ch <= 'z' ){
node[++pos].ch = ch;
if( node[now].next != -1 )
node[node[now].next].pre = pos;
node[pos].next = node[now].next; node[now].next = pos;
node[pos].pre = now;
now = pos;
}
else
break;
}
now = node[0].next;
while(now != -1 ){
printf("%c",node[now].ch);
now = node[now].next;
}
puts("");
return 0;
}
相關文章
- AURIX TC397 SCU 之 Watchdog 看門狗
- ZROJ#397. 【18提高7】模仿遊戲(爆搜)遊戲
- 010 Editor Mac版最新 +010 Editor 註冊碼Mac
- text
- Fixed "There was a problem with the editor 'vi'"
- UE.getEditor('editor')
- mysql_config_editorMySql
- omi ace markdown editor
- react markdown editor示例React
- stencil ace markdown editor
- text/html和text/plain的區別HTMLAI
- Text Representation
- JSON Editor 中文文件JSON
- Ace editor中文文件
- vue3-excel-editorVueExcel
- v-md-editor示例
- react-markdown-editor示例React
- mysql_config_editor元件MySql元件
- CSS 文字裝飾 text-decoration & text-emphasisCSS
- ORACLE TEXT(轉)Oracle
- DAN Text Classification
- text1
- text-to-motion
- mysql_config_editor 配置工具MySql
- VS2010 Opened in another editor
- astro react ace markdown editor and previewerASTReactView
- react-md-editor使用示例React
- monaco-editor 的 Language Services
- Editor.md 使用小結
- WPF Text MultiBinding StringFormatORM
- CSS text-strokeCSS
- CSS text-shadowCSS
- CSS text-overflowCSS
- Oracle Text簡介Oracle
- ASBFAT:Sublime Text 3
- Leetcode 68 Text JustificationLeetCode
- 深入char、varchar、text
- mysql_config_editor用法舉例MySql
- 【譯】New experimental Razor editor for Visual Studio