
栈
文章平均质量分 87
synapse7
这个作者很懒,什么都没留下…
展开
-
HDU 1022 Train Problem I (栈)
Train Problem Ihttp://acm.hdu.edu.cn/showproblem.php?pid=1022Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Problem DescriptionAs the原创 2013-08-25 17:07:57 · 1045 阅读 · 0 评论 -
UVa 11995 I Can Guess the Data Structure! (STL)
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=3146注意“without error”这句。/*0.038s*/#include#include#includeusing namespace st原创 2014-03-03 20:27:43 · 844 阅读 · 0 评论 -
POJ 2796 Feel Good (单调栈)
http://poj.org/problem?id=2796和POJ 2559一样,把计算矩形的长改为前缀和就行。完整代码:/*891ms,2716KB*/#include#includeusing namespace std;const int mx = 100005;__int64 h[mx], sum[mx];int l[mx], r[mx];原创 2014-03-03 10:16:58 · 1085 阅读 · 0 评论 -
C++ STL入门教程(4)——stack(栈),queue(队列),priority_queue(优先队列)的使用(附完整程序代码)
首先,这三者都是顺序容器适配器(适配器(adaptor)是根据原始的容器类型所提供的操作,通过定义新的操作接口,来适应基础的容器类型)。本质上,适配器是使一事物的行为类似于另一事物的行为的一种机制。容器适配器让一种已存在的容器类型采用另一种不同的抽象类型的工作方式实现。例如,假设deq是deque类型的容器,则可以用deq初始化一个新的栈:stack stk(deq);//带容器参数的原创 2013-08-04 22:40:27 · 3671 阅读 · 0 评论 -
POJ 1028 / East Central North America 2001 Web Navigation (栈)
Web Navigationhttp://poj.org/problem?id=1028Time Limit: 1000MSMemory Limit: 10000KDescriptionStandard web browsers contain features to move backward and forward among the p原创 2013-08-29 16:37:28 · 1590 阅读 · 0 评论 -
POJ 2106 / México and Central America 2004 Boolean Expressions (用栈处理表达式)
Boolean Expressionshttp://poj.org/problem?id=2106Time Limit: 1000MSMemory Limit: 30000KDescriptionThe objective of the program you are going to produce is to evaluate boolean e原创 2013-10-25 16:30:52 · 1982 阅读 · 0 评论 -
用两个栈实现一个队列——我作为面试官的小结
(PS:可在《算法(第四版)》的1.3.49看到此题)两年前从网上看到一道面试题:用两个栈(Stack)实现一个队列(Queue)。觉得不错,就经常拿来面试,几年下来,做此题的应该有几十人了。通过对面试者的表现和反应,有一些统计和感受,在此做个小结。 用C++描述,题目大致是这样的: 已知下面Stack类及其3个方法Push、Pop和 Count,请用2个Stack实现转载 2014-01-11 10:04:40 · 918 阅读 · 0 评论 -
UVa 442/HDU 1082/ZOJ 1094 Matrix Chain Multiplication(模拟&栈)
442 - Matrix Chain MultiplicationTime limit: 3.000 secondsSuppose you have to evaluate an expression like A*B*C*D*E where A,B,C,D and E are matrices. Since matrix multiplication is associative,原创 2013-08-02 16:27:23 · 1559 阅读 · 5 评论 -
URAL 1654 Cipher Message(栈)
1654. Cipher MessageTime limit: 1.0 secondMemory limit: 64 MBMüller tried to catch Stierlitz red-handed many times, but always failed because Stierlitz could ever find some excuse. Once原创 2013-07-25 11:42:50 · 2106 阅读 · 1 评论 -
UVa 673 Parentheses Balance (栈)
673 - Parentheses BalanceTime limit: 3.000 secondshttp://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=103&page=show_problem&problem=614You are given a string consis原创 2013-09-18 09:25:51 · 1983 阅读 · 4 评论 -
UVa 127 "Accordian" Patience (模拟链表&栈)
127 - "Accordian" PatienceTime limit: 3.000 secondshttp://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=103&page=show_problem&problem=63You are to simulate the p原创 2013-08-02 10:44:34 · 1186 阅读 · 0 评论 -
URAL 1915 Titan Ruins: Reconstruction of Bygones (栈)
1915. Titan Ruins: Reconstruction of BygonesTime limit: 1.0 secondMemory limit: 64 MB`It seems that we're in a trap,' said Soren.`A very familiar phrase,' Alba replied.The friend原创 2013-08-31 14:09:18 · 997 阅读 · 0 评论 -
POJ 2559 / HDU 1506 / LightOJ 1083 Largest Rectangle in a Histogram (单调栈)
Largest Rectangle in a Histogramhttp://poj.org/problem?id=2559Time Limit: 1000MSMemory Limit: 65536KDescriptionA histogram is a polygon composed of a sequence of rectangles ali原创 2013-09-19 18:07:02 · 1859 阅读 · 0 评论