栈
文章平均质量分 84
纯纯的心儿
每天都在赚事业。。
展开
-
入栈和出栈
Description假设有一组数,共n个,如23、45、17、93、27、6、91、13,依次入栈(23最先入栈,13最后出栈),给定这n个数入栈和出栈的操作序列(push表示入栈,pop表示出栈),要求输出这n个数的出栈顺序。例如,假设入栈和出栈的操作序列为:push pop push push pop push pop push pop pop push push push原创 2015-03-26 17:15:53 · 6656 阅读 · 0 评论 -
hdu 1237简单计算器
题目描述Problem Description读入一个只包含 +, -, *, / 的非负整数计算表达式,计算该表达式的值。Input测试输入包含若干测试用例,每个测试用例占一行,每行不超过200个字符,整数和运算符之间用一个空格分隔。没有非法表达式。当一行中只有0时输入结束,相应的结果不要输出。Output对每个测试用例输出1行,即该表达式的值,精确到小数点后2位翻译 2015-03-23 21:17:12 · 413 阅读 · 0 评论 -
Eliminate Witches!2011年北京网络赛
Kaname Madoka is a Magical Girl(Mahou Shoujo/Puella Magi). The duty of a Magical Girl is to eliminate Witches(Majo). Though sounds horrific, it is not a hard job for her as a powerful magical girl.翻译 2015-03-24 12:48:27 · 682 阅读 · 0 评论 -
UVa514 Rails
题目:铁轨题目链接: UVa514链接 题目描述:某城市有一个火车站,有n节车厢从A方向驶入车站,按进站的顺序编号为1-n.你的任务是判断是否能让它们按照某种特定的顺序进入B方向的铁轨并驶入车站。例如,出栈顺序(5 4 1 2 3)是不可能的,但是(5 4 3 2 1)是可能的。 输入n 代表n节车厢,输入一列序,输出是否可以这样的出站; 分析:这题是一道关翻译 2015-03-24 12:34:14 · 632 阅读 · 0 评论 -
POJ-1068 Parencodings
题目表述:Problem DescriptionLet S = s1 s2 … s2n be a well-formed string of parentheses. S can be encoded in two different ways:By an integer sequence P = p1 p2 … pn where pi is the number of le原创 2015-03-23 21:27:26 · 495 阅读 · 0 评论 -
括号匹配 加 括号的对数
#include #include#include #include using namespace std;int s[1000005]; //存括号的层数 stackq;int main(){ int bbs,k=1; scanf("%d",&bbs); getchar(); while(bbs--) { int max原创 2015-04-20 12:54:11 · 1372 阅读 · 0 评论