Given a set of distinct integers, S, return all possible subsets. Note: Elements in a subset must be in non-descending order.The solution set must not ...
分类:
其他好文 时间:
2017-04-22 12:29:14
阅读次数:
172
“我跟你们说,你们知道STL容器,vector/string/deque等等,都有个reserve方法吗?你们一个个地push_back,嫌C++比C慢,怪谁?” “要像我这样,预先分配足够大的空间,这样push_back的时候才快,明不明白?” “别老说写C比写C++好,因为C代码怎么运行的都在自 ...
分类:
编程语言 时间:
2017-04-05 09:55:09
阅读次数:
219
#include using namespace std; const int maxn=500011; const int inf=1 #define pb push_back #define cl(a,b) memset(a,b,sizeof(a)); int a[maxn]; int main... ...
分类:
其他好文 时间:
2017-04-03 16:00:52
阅读次数:
203
#include<iostream>#include<string>#include<vector>using namespace std;int main(){ vector <string> name; name.push_back("xiao jia yu ~"); name.push_bac ...
分类:
其他好文 时间:
2017-03-29 19:09:53
阅读次数:
124
#include<iostream>#include<string>#include<vector>#include<algorithm>using namespace std;int main(){ vector <string> names; names.push_back("WXH"); na ...
分类:
其他好文 时间:
2017-03-29 18:32:29
阅读次数:
99
C++里的char和string C++中的char是个基本类型,跟int一样;而string却是个库自带的类,string这个类包括很多成员函数,比如push_back(), insert(), append()等,声明的变量是个对象,但不需要程序员自动析构 C++里的 cstring对应C语言的 ...
分类:
编程语言 时间:
2017-03-23 21:39:33
阅读次数:
178
map 插入 vector 之前在开发板上使用 m_vec[0] = "aaaaa"; 这种方式,然后用 m_map[0] = m_vec; 发现m_vec赋值不成功。要用m_vec.push_back("aaaa")这种方式才能赋值给map。 但在台式linux上不存在这种情况。 ...
分类:
编程语言 时间:
2017-03-22 16:30:52
阅读次数:
253
BFS: breadth first search 107. Binary Tree Level Order Traversal II 解题思路: 本来我是用map<int,int>存所有节点的值和深度(root是0),然后遍历map,result[depth].push_back(val)。但是因 ...
分类:
其他好文 时间:
2017-03-19 17:35:24
阅读次数:
164
该程序初步演示了我对vector在分配内存的时候的理解。可能有误差,随着理解的改变,改代码可以被修改。 1 /* 2 功能说明: 3 vector的内存分配机制分析。 4 代码说明: 5 vector所管理的内存地址是连续的。程序在不断的push_back的过程中,如果当前所管理的内存不能装下新的元 ...
分类:
其他好文 时间:
2017-02-26 12:13:48
阅读次数:
653
学习了一下平面图剖分的姿势,orz cbh 每次只要随便选择一条边,然后不停尽量向左转就行 #include <bits/stdc++.h> #define N 1300000 #define M 5000013 #define LL long long #define pb push_back u ...
分类:
其他好文 时间:
2016-12-04 00:48:00
阅读次数:
179