摘要: 栈#include<stack> //头文件stack<char> st; //定义st.push(str1[0]); //入栈cur=st.top (); //取栈顶值st.pop(); //出栈st.empty ()//空为true队列#include<queue>queue<char>que;que.push(a);a=que.front();que.pop();que.empty ()优先队列bool operator < (const coor &a, const coor &b){ return a.time & 阅读全文
posted @ 2011-03-27 21:04 CoderZhuang 阅读(254) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1515http://www.cnblogs.com/liuqidong/archive/2010/07/26/1785076.html:本题并不是很难,就是输出所有能够目标WORD的可能。所以dfs+stack很容易解决。递归时有两种情况:第一:两个字符不相等(即栈顶字符与目标字符不相等);这种情况很容易处理,将匹配word的下一个字符入栈,指针向后挪已为继续递归。第二:两个字符相等(即栈顶字符与目标字符相等);这种情况有两种选择 (1)字符出栈,并将目标word的指针向后挪一位,继续递归;(2)将匹配wor 阅读全文
posted @ 2011-03-27 20:58 CoderZhuang 阅读(228) 评论(0) 推荐(0) 编辑