![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
STL
小天位
这个作者很懒,什么都没留下…
展开
-
续vector
//c.push_back(elem)在尾部插入一个elem数据。vector v;v.push_back(1);//c.pop_back()删除末尾的数据。 vector v; v.pop_back();//c.assign(beg,end)将[beg,end)一个左闭右开区间的数据赋值给c。vector v1,v2;v1.push_back(10);v1.pus原创 2017-08-25 14:51:40 · 217 阅读 · 0 评论 -
next_permutation函数
next_permutation()函数功能是输出所有比当前排列大的排列,顺序是从小到大。而prev_permutation()函数功能是输出所有比当前排列小的排列,顺序是从大到小。http://blog.csdn.net/acdreamers/article/details/8544505http://blog.sina.com.cn/s/blog_9f7ea4390原创 2017-11-27 19:22:53 · 195 阅读 · 0 评论 -
lower_bound()、upper_bound()
lower_bound()函数lower_bound()在first和last中的前闭后开区间进行二分查找,返回大于或等于(upper_bound()是大于这个元素的第一个值得位置,没有等于)val的第一个元素位置。如果所有元素都小于val,则返回last的位置例:4,10,11,30,69,70,96,100.设要插入数字3,9,111.pos为要插入的位置的下标pos = lowe...转载 2018-01-22 19:32:45 · 217 阅读 · 0 评论 -
5-1uva1593
#include <iostream>#include <string.h>#include <sstream>//#include <bits/stdc++.h>using namespace std;int main(){ string str,s[1000][180]; int a=0,b=0,x[1000],y[1...原创 2018-03-24 17:55:44 · 189 阅读 · 0 评论 -
5-2 uva1594
uva 1954#include<iostream>#include<iomanip>#include<string>#include<vector>#include<map>#include <bits/stdc++.h>using namespace std;bool judge(vector<int&原创 2018-03-24 17:56:16 · 151 阅读 · 0 评论 -
uva-1597
#include<iostream>#include<cstdio>#include<cstring>#include<map>#include<vector>#include<sstream>using namespace std;map<string,vector<int> &原创 2018-03-24 17:56:58 · 276 阅读 · 0 评论 -
Sonya and Queries CodeForces - 714C
Today Sonya learned about long integers and invited all her friends to share the fun. Sonya has an initially empty multiset with integers. Friends give her tqueries, each of one of the following type:...原创 2018-03-24 17:58:32 · 135 阅读 · 0 评论 -
素数个数
用 0,1,2,3 \cdots 70,1,2,3⋯7 这 88 个数组成的所有整数中,质数有多少个(每个数字必须用到且只能用一次)。提示:以 00 开始的数字是非法数字。#include <iostream>#include <cstdio>#include <cstring>#include <set>#include <math....原创 2018-03-26 11:38:50 · 397 阅读 · 0 评论 -
第四周实践项目8 C++标准模板库与数据结构的学习
贺老的博客c++参考手册STL入门转载 2017-12-13 13:45:11 · 202 阅读 · 0 评论 -
sdut 2127 树-堆结构练习——合并果子之哈夫曼树 && 优先队列
Problem Description 在一个果园里,多多已经将所有的果子打了下来,而且按果子的不同种类分成了不同的堆。多多决定把所有的果子合成一堆。每一次合并,多多可以把两堆果子合并到一起,消耗的体力等于两堆果子的重量之和。可以看出,所有的果子经过n-1次合并之后,就只剩下一堆了。多多在合并果子时总共消耗的体力等于每次合并所消耗体力之和。因为还要花大力气把这些果子搬回家,所以多多原创 2017-11-07 21:23:29 · 225 阅读 · 0 评论 -
list
list容器就是一个双向链表,可以高效地进行插入删除元素。list c0; //空链表list c1(3); //建一个含三个默认值是0的元素的链表list c2(5,2); //建一个含五个元素的链表,值都是2list c4(c2); //建一个c2的copy链表list c5(c1.begin(),c1.end()); ////c5含c1一个区域的元素[_First, _Last)原创 2017-08-25 15:24:04 · 204 阅读 · 0 评论 -
deque双向队列
//查找 const int FINDNUMBER = 19; printf("\n查找%d\n", FINDNUMBER); pos = find(ideq.begin(), ideq.end(), FINDNUMBER); if (pos != ideq.end()) printf("find %d success\n", *...原创 2017-08-25 12:48:31 · 355 阅读 · 0 评论 -
sdut 2141 BFS(用邻接矩阵和邻接表(采用优先队列)实现
Problem Description给定一个无向连通图,顶点编号从0到n-1,用广度优先搜索(BFS)遍历,输出从某个顶点出发的遍历序列。(同一个结点的同层邻接点,节点编号小的优先遍历)Input输入第一行为整数n(0对于每组数据,第一行是三个整数k,m,t(0<k<100,0<m<(k-1)*k/2,0< t<k),表示有m条边,k个顶点,t为遍历的起始顶点。原创 2017-11-15 10:10:41 · 281 阅读 · 0 评论 -
STL_vector<>
/*1. 迭代器(iterator)是一种检查容器内元素并遍历元素的数据类型。(1) 每种容器类型都定义了自己的迭代器类型,如vector: vector::iterator iter;这条语句定义了一个名为iter的变量,它的数据类型是由vector定义的iterator类型。 还可以定义struct类型 struct review { string ti原创 2017-08-25 11:19:22 · 232 阅读 · 0 评论 -
new_delete_指针
//use pointer to change value*p_updates=*p_updates+1;cout<<"now updates="<<*p_updates<<endl;long *fellow//create a pointer-to-long*fellow=2333//place a value in never-never land//use_new.cpp#i原创 2017-08-24 14:45:03 · 341 阅读 · 0 评论 -
优先队列讲解
/*程序大意就是在这个优先队列里依次插入10、8、12、14、6,再输出。结果是什么呢?14 12 10 8 6也就是说,它是按从大到小排序的!*/#include#includeusing namespace std;priority_queue q;int main(){ q.push(10),q.push(8),q.push(12),q.push(14),q.pu原创 2017-11-08 21:17:04 · 158 阅读 · 0 评论 -
C++STL 常用 函数 用法
http://www.cnblogs.com/duoduo369/archive/2012/04/12/2439118.html转载 2017-10-19 21:20:42 · 287 阅读 · 0 评论 -
sdut 3345 哈夫曼编码 &&优先队列
Problem Description字符的编码方式有多种,除了大家熟悉的ASCII编码,哈夫曼编码(Huffman Coding)也是一种编码方式,它是可变字长编码。该方法完全依据字符出现概率来构造出平均长度最短的编码,称之为最优编码。哈夫曼编码常被用于数据文件压缩中,其压缩率通常在20%~90%之间。你的任务是对从键盘输入的一个字符串求出它的ASCII编码长度和哈夫曼编码长度的比值。原创 2017-11-07 20:48:23 · 453 阅读 · 0 评论 -
cf 552 (Div. 3)Two Teams
There aren students standing in a row. Two coaches are forming two teams — the first coach chooses the first team and the second coach chooses the second team.Thei -th student has integer programm...原创 2019-04-17 12:54:39 · 240 阅读 · 0 评论