UVA-11234
来源:互联网 发布:wpf编程宝典 2012 pdf 编辑:程序博客网 时间:2024/06/06 04:29
#include<iostream>#include<cstdio>#include<stack>#include<queue>#include<string>#define maxn 10050using namespace std;struct Node{ char c; int id,u,v;} node[maxn];int T,i,t,sum;Node node1,node2;char ch;string ss[210];string ans,ans1;void init(){ for(int i=0; i<maxn; i++) { node[i].u=node[i].v=-1; node[i].id=i; }}int main(){ cin>>T; getchar(); while(T--) { getline(cin,ss[i++]); } for(int j=0; j<i; j++) { init(); t=0;ans=""; stack<char>s; stack<Node>s1; int len=ss[j].length(); for(int k=len-1; k>=0; k--) s.push(ss[j][k]); while(!s.empty()) { ch=s.top(); s.pop(); node[t].c=ch; if(ch>='a'&&ch<='z'); else { node[t].v=s1.top().id; s1.pop(); node[t].u=s1.top().id; s1.pop(); } s1.push(node[t]);t++; } queue<Node>q; q.push(node[t-1]); while(!q.empty()) { node1=q.front(); ans+=node1.c; q.pop(); if(node1.u!=-1) { q.push(node[node1.u]); q.push(node[node1.v]); } } int len1=ans.length(); for(int i=len1-1;i>=0;i--) cout<<ans[i]; cout<<endl; } return 0;}
0 0
- uva 11234
- UVA 11234
- uva 11234
- uva 11234
- UVA-11234
- uva 11234
- UVA 11234
- UVa 11234 Expressions
- uva 11234 - Expressions
- UVa 11234 Expressions
- uva 11234 - Expressions
- UVa 11234 - Expressions
- UVA 11234 - Expressions
- UVa 11234 - Expressions
- UVA 11234 - Expressions
- uva 11234 - Expressions
- UVA 11234 - Expressions
- uva-11234 Expressions
- 网站的标题定位的重要性
- <PY><core python programming 笔记>C1 概述
- 操作系统学习笔记——Mach, Monolithic kernel, Microkernels, Exokernel
- Expectation Maximization Algorithm(EM)算法
- V4L2驱动程序架构
- UVA-11234
- java--多线程实现计数器
- H.264多参考帧
- Android Activity生命周期
- 导入图标
- linux学习的网址收集整理
- TPS76750接线图 TPS76750连接图
- HDU 1111 Secret Code DFS 解题报告
- 八皇后问题-回溯法-c语言