![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
stl
成长-小屁孩
这个作者很懒,什么都没留下…
展开
-
括号配对问题 stack 练习
push(x) 入栈pop()出栈top() 访问栈顶empty()判断栈空 为空返回truesize() 栈中的元素个数#include#include#includeusing namespace std;char change( char c ){ return c == ']' ? '[' : '(';}bool match( cha原创 2012-10-15 15:23:46 · 221 阅读 · 0 评论 -
%*c 吸收字符 n-1位数
#include#includeusing namespace std;int main(){ int t,m; scanf("%d",&t); while (t--) { scanf("%*c%*c%d",&m); printf("%d\n",m); }}原创 2012-10-23 20:26:28 · 680 阅读 · 0 评论 -
stack练习 汉诺塔(三)
#include#include#includeusing namespace std;int main(){ int t,p,q,a,b; bool flag; scanf("%d",&t); while (t--) { stack han[3]; flag = true;原创 2012-10-22 20:29:42 · 379 阅读 · 0 评论 -
stl map 众数问题
#include#include#include#includeusing namespace std;int main(){ int t,n,a; scanf("%d",&t); while (t--) { map ma; map ::iterator it;原创 2012-10-23 13:48:39 · 215 阅读 · 0 评论 -
vector + 区间最大(min_element) + 区间最小(min_element)
#include #include #include using namespace std;int main(){ vector v; int a; for (int i = 0; i < 5; i++) { scanf("%d", &a); v.push_back(a); }原创 2012-10-17 14:18:06 · 543 阅读 · 0 评论 -
擅长排列的小明 string + next_permutation 全排列
#include #include #include using namespace std; int main() { int i,j,k,T; cin>>T; while(T--) { int x,y; string s1,s2; ci原创 2012-10-17 11:20:54 · 243 阅读 · 0 评论 -
一种排序 set 对结构体的排序 重载 <
#include#include#include#includeusing namespace std;struct Node{ int key,len,wei;}q;bool operator < (const Node& r1,const Node& r2){ return r1.key<r2.key || r1.key=原创 2012-10-17 11:22:50 · 386 阅读 · 0 评论 -
Binary String Matching -- stl string 常用函数
#include#include#includeusing namespace std;int main(){ string s,a; int t; scanf("%d",&t); while (t--) { cin >> a >> s; int al = a.length();原创 2012-10-15 17:25:20 · 223 阅读 · 0 评论 -
ASCII码排序 c++ list 练习
begin() //返回第一个元素的指针(iterator)clear() //删除所有元素empty() //判断是否链表为空end() //返回最后一个元素的下一位置的指针(list为空时end()=begin())erase() //删除一个元素或一个区域的元素(两个重载)front() //返回第一个元素的引用sort() //对链表排序,默认升序(可自定义)原创 2012-10-15 16:04:02 · 471 阅读 · 0 评论 -
zoj 1094 Matrix Chain Multiplication
#include#include#includeusing namespace std;struct Mat{ int x,y;}mat[26];char str[100];bool flag;int t;stack ma;int MatRide (Mat &a,Mat b){ if ( a.y == b.x原创 2012-10-25 22:01:10 · 151 阅读 · 0 评论